Refactor doom-cli--generate-autoloads
This commit is contained in:
parent
497a6a206e
commit
0b1ab39a00
1 changed files with 26 additions and 26 deletions
|
@ -219,29 +219,29 @@ it is nil, it will try to reload both."
|
||||||
(defun doom-cli--generate-autoloads (files &optional scan)
|
(defun doom-cli--generate-autoloads (files &optional scan)
|
||||||
(require 'autoload)
|
(require 'autoload)
|
||||||
(let (autoloads)
|
(let (autoloads)
|
||||||
(dolist (file files (delq nil (nreverse autoloads)))
|
(dolist (file
|
||||||
(and (file-readable-p file)
|
(cl-remove-if-not #'file-readable-p files)
|
||||||
(with-temp-buffer
|
(nreverse (delq nil autoloads)))
|
||||||
(save-excursion
|
(with-temp-buffer
|
||||||
(if scan
|
(if scan
|
||||||
(doom-cli--generate-autoloads-buffer file)
|
(doom-cli--generate-autoloads-buffer file)
|
||||||
(insert-file-contents-literally file)))
|
(insert-file-contents-literally file))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((filestr (prin1-to-string file)))
|
(let ((filestr (prin1-to-string file)))
|
||||||
(while (re-search-forward "\\_<load-file-name\\_>" nil t)
|
(while (re-search-forward "\\_<load-file-name\\_>" nil t)
|
||||||
;; `load-file-name' is meaningless in a concatenated
|
;; `load-file-name' is meaningless in a concatenated
|
||||||
;; mega-autoloads file, so we replace references to it with the
|
;; mega-autoloads file, so we replace references to it with the
|
||||||
;; file they came from.
|
;; file they came from.
|
||||||
(unless (doom-point-in-string-or-comment-p)
|
(unless (doom-point-in-string-or-comment-p)
|
||||||
(replace-match filestr t t)))))
|
(replace-match filestr t t)))))
|
||||||
(let ((load-file-name file)
|
(let ((load-file-name file)
|
||||||
(load-path
|
(load-path
|
||||||
(append (list doom-private-dir)
|
(append (list doom-private-dir)
|
||||||
doom-modules-dirs
|
doom-modules-dirs
|
||||||
load-path)))
|
load-path)))
|
||||||
(condition-case _
|
(condition-case _
|
||||||
(while t
|
(while t
|
||||||
(push (doom-cli--filter-form (read (current-buffer))
|
(push (doom-cli--filter-form (read (current-buffer))
|
||||||
scan)
|
scan)
|
||||||
autoloads))
|
autoloads))
|
||||||
(end-of-file))))))))
|
(end-of-file)))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue