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,7 +190,6 @@ it is nil, it will try to reload both."
(module-enabled-p (print form))))))) (module-enabled-p (print form)))))))
(defun doom-cli--generate-autoloads-buffer (file) (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 (let* (;; Prevent `autoload-find-file' from firing file hooks, e.g. adding
;; to recentf. ;; to recentf.
find-file-hook find-file-hook
@ -208,13 +207,14 @@ it is nil, it will try to reload both."
(generated-autoload-load-name (file-name-sans-extension file)) (generated-autoload-load-name (file-name-sans-extension file))
(target-buffer (current-buffer)) (target-buffer (current-buffer))
(module (doom-module-from-path file)) (module (doom-module-from-path file))
(module-enabled-p (or (memq (car module) '(:core :private)) (module-enabled-p (and (or (memq (car module) '(:core :private))
(doom-module-p (car module) (cdr module))))) (doom-module-p (car module) (cdr module)))
(doom-file-cookie-p file "if" t))))
(save-excursion (save-excursion
(when module-enabled-p (when module-enabled-p
(quiet! (autoload-generate-file-autoloads file target-buffer))) (quiet! (autoload-generate-file-autoloads file target-buffer)))
(doom-cli--generate-autoloads-autodefs (doom-cli--generate-autoloads-autodefs
file target-buffer module module-enabled-p))))) file target-buffer module module-enabled-p))))
(defun doom-cli--generate-autoloads (files &optional scan) (defun doom-cli--generate-autoloads (files &optional scan)
(require 'autoload) (require 'autoload)