Add doom-autoloads-excluded-files variable
So specific/problematic files can be omitted from autoloads.
This commit is contained in:
parent
dc89eb239c
commit
5d0f781062
1 changed files with 41 additions and 32 deletions
|
@ -7,6 +7,10 @@ These packages have silly or destructive autoload files that try to load
|
||||||
everyone in the universe and their dog, causing errors that make babies cry. No
|
everyone in the universe and their dog, causing errors that make babies cry. No
|
||||||
one wants that.")
|
one wants that.")
|
||||||
|
|
||||||
|
(defvar doom-autoloads-excluded-files
|
||||||
|
'("/bufler/bufler-workspaces-tabs\\.el$")
|
||||||
|
"List of regexps whose matching files won't be indexed for autoloads.")
|
||||||
|
|
||||||
(defvar doom-autoloads-cached-vars
|
(defvar doom-autoloads-cached-vars
|
||||||
'(doom-modules
|
'(doom-modules
|
||||||
doom-disabled-packages
|
doom-disabled-packages
|
||||||
|
@ -49,11 +53,13 @@ one wants that.")
|
||||||
(list doom-private-dir))
|
(list doom-private-dir))
|
||||||
if (doom-glob dir "autoload.el") collect it
|
if (doom-glob dir "autoload.el") collect it
|
||||||
if (doom-glob dir "autoload/*.el") append it)
|
if (doom-glob dir "autoload/*.el") append it)
|
||||||
(mapcan #'doom-glob doom-autoloads-files)))
|
(mapcan #'doom-glob doom-autoloads-files))
|
||||||
|
nil)
|
||||||
(doom-autoloads--scan
|
(doom-autoloads--scan
|
||||||
(mapcar #'straight--autoloads-file
|
(mapcar #'straight--autoloads-file
|
||||||
(seq-difference (hash-table-keys straight--build-cache)
|
(seq-difference (hash-table-keys straight--build-cache)
|
||||||
doom-autoloads-excluded-packages))
|
doom-autoloads-excluded-packages))
|
||||||
|
doom-autoloads-excluded-files
|
||||||
'literal))
|
'literal))
|
||||||
(print! (start "Byte-compiling autoloads file..."))
|
(print! (start "Byte-compiling autoloads file..."))
|
||||||
(doom-autoloads--compile-file file)
|
(doom-autoloads--compile-file file)
|
||||||
|
@ -189,35 +195,38 @@ one wants that.")
|
||||||
(doom-autoloads--scan-autodefs
|
(doom-autoloads--scan-autodefs
|
||||||
file target-buffer module module-enabled-p))))
|
file target-buffer module module-enabled-p))))
|
||||||
|
|
||||||
(defun doom-autoloads--scan (files &optional literal)
|
(defun doom-autoloads--scan (files &optional exclude literal)
|
||||||
(require 'autoload)
|
(require 'autoload)
|
||||||
(let (autoloads)
|
(let (case-fold-search ; case-sensitive regexp from here on
|
||||||
(dolist (file
|
autoloads)
|
||||||
(seq-filter #'file-readable-p files)
|
(dolist (file files (nreverse (delq nil autoloads)))
|
||||||
(nreverse (delq nil autoloads)))
|
(when (and (or (null exclude)
|
||||||
(with-temp-buffer
|
(seq-remove (doom-rpartial #'string-match-p file)
|
||||||
(print! (debug "- Scanning %s") (relpath file doom-emacs-dir))
|
exclude))
|
||||||
(if literal
|
(file-readable-p file))
|
||||||
(insert-file-contents file)
|
(doom-log "Scanning %s" file)
|
||||||
(doom-autoloads--scan-file file))
|
(with-temp-buffer
|
||||||
(save-excursion
|
(if literal
|
||||||
(let ((filestr (prin1-to-string file)))
|
(insert-file-contents file)
|
||||||
(while (re-search-forward "\\_<load-file-name\\_>" nil t)
|
(doom-autoloads--scan-file file))
|
||||||
;; `load-file-name' is meaningless in a concatenated
|
(save-excursion
|
||||||
;; mega-autoloads file, so we replace references to it with the
|
(let ((filestr (prin1-to-string file)))
|
||||||
;; file they came from.
|
(while (re-search-forward "\\_<load-file-name\\_>" nil t)
|
||||||
(let ((ppss (save-excursion (syntax-ppss))))
|
;; `load-file-name' is meaningless in a concatenated
|
||||||
(or (nth 3 ppss)
|
;; mega-autoloads file, so we replace references to it with the
|
||||||
(nth 4 ppss)
|
;; file they came from.
|
||||||
(replace-match filestr t t))))))
|
(let ((ppss (save-excursion (syntax-ppss))))
|
||||||
(let ((load-file-name file)
|
(or (nth 3 ppss)
|
||||||
(load-path
|
(nth 4 ppss)
|
||||||
(append (list doom-private-dir)
|
(replace-match filestr t t))))))
|
||||||
doom-modules-dirs
|
(let ((load-file-name file)
|
||||||
load-path)))
|
(load-path
|
||||||
(condition-case _
|
(append (list doom-private-dir)
|
||||||
(while t
|
doom-modules-dirs
|
||||||
(push (doom-autoloads--cleanup-form (read (current-buffer))
|
load-path)))
|
||||||
(not literal))
|
(condition-case _
|
||||||
autoloads))
|
(while t
|
||||||
(end-of-file)))))))
|
(push (doom-autoloads--cleanup-form (read (current-buffer))
|
||||||
|
(not literal))
|
||||||
|
autoloads))
|
||||||
|
(end-of-file))))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue