Fix #2278: autoload gen skipping disabled autodefs

If a ;;;###if module cookie returned nil for a file, it should still
allow autodefs to be scraped from it, which wasn't happening before this
fix.

An autodef's guarantee is that it will always be defined, whether or not
the containing module is enabled.
This commit is contained in:
Henrik Lissner 2019-12-30 23:19:56 -05:00
parent 960d756b47
commit 7c968a8b11
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -190,31 +190,31 @@ it is nil, it will try to reload both."
(module-enabled-p (print form)))))))
(defun doom-cli--generate-autoloads-buffer (file)
(when (doom-file-cookie-p file "if" t)
(let* (;; Prevent `autoload-find-file' from firing file hooks, e.g. adding
;; to recentf.
find-file-hook
write-file-functions
;; Prevent a possible source of crashes when there's a syntax error
;; in the autoloads file
debug-on-error
;; The following bindings are in `package-generate-autoloads'.
;; Presumably for a good reason, so I just copied them
(backup-inhibited t)
(version-control 'never)
case-fold-search ; reduce magic
autoload-timestamps ; reduce noise in generated files
;; Needed for `autoload-generate-file-autoloads'
(generated-autoload-load-name (file-name-sans-extension file))
(target-buffer (current-buffer))
(module (doom-module-from-path file))
(module-enabled-p (or (memq (car module) '(:core :private))
(doom-module-p (car module) (cdr module)))))
(save-excursion
(when module-enabled-p
(quiet! (autoload-generate-file-autoloads file target-buffer)))
(doom-cli--generate-autoloads-autodefs
file target-buffer module module-enabled-p)))))
(let* (;; Prevent `autoload-find-file' from firing file hooks, e.g. adding
;; to recentf.
find-file-hook
write-file-functions
;; Prevent a possible source of crashes when there's a syntax error
;; in the autoloads file
debug-on-error
;; The following bindings are in `package-generate-autoloads'.
;; Presumably for a good reason, so I just copied them
(backup-inhibited t)
(version-control 'never)
case-fold-search ; reduce magic
autoload-timestamps ; reduce noise in generated files
;; Needed for `autoload-generate-file-autoloads'
(generated-autoload-load-name (file-name-sans-extension file))
(target-buffer (current-buffer))
(module (doom-module-from-path file))
(module-enabled-p (and (or (memq (car module) '(:core :private))
(doom-module-p (car module) (cdr module)))
(doom-file-cookie-p file "if" t))))
(save-excursion
(when module-enabled-p
(quiet! (autoload-generate-file-autoloads file target-buffer)))
(doom-cli--generate-autoloads-autodefs
file target-buffer module module-enabled-p))))
(defun doom-cli--generate-autoloads (files &optional scan)
(require 'autoload)