case-fold-search = nil in reload-package-autoloads
Slight optimization.
This commit is contained in:
parent
2d5ac8a164
commit
5295f36115
1 changed files with 34 additions and 33 deletions
|
@ -201,39 +201,40 @@ This should be run whenever your `doom!' block or update your packages."
|
|||
(with-temp-file doom-package-autoload-file
|
||||
(insert ";;; -*- lexical-binding:t -*-\n"
|
||||
";; This file is autogenerated by `doom//reload-package-autoloads', DO NOT EDIT !!\n\n")
|
||||
(save-excursion
|
||||
;; Cache the important and expensive-to-initialize state here.
|
||||
(doom-initialize-packages)
|
||||
(prin1 `(setq load-path ',load-path
|
||||
auto-mode-alist ',auto-mode-alist
|
||||
Info-directory-list ',Info-directory-list
|
||||
doom-disabled-packages ',doom-disabled-packages
|
||||
package-activated-list ',package-activated-list)
|
||||
(current-buffer))
|
||||
(print! (green "✓ Cached package state"))
|
||||
;; insert package autoloads
|
||||
(dolist (spec package-alist)
|
||||
(if-let* ((pkg (car spec))
|
||||
(desc (cadr spec)))
|
||||
(unless (memq pkg doom-autoload-excluded-packages)
|
||||
(let ((file (concat (package--autoloads-file-name desc) ".el")))
|
||||
(when (file-exists-p file)
|
||||
(insert "(let ((load-file-name " (prin1-to-string (abbreviate-file-name file)) "))\n")
|
||||
(insert-file-contents file)
|
||||
(while (re-search-forward "^\\(?:;;\\(.*\n\\)\\|\n\\)" nil t)
|
||||
(unless (nth 8 (syntax-ppss))
|
||||
(replace-match "" t t)))
|
||||
(unless (bolp) (insert "\n"))
|
||||
(insert ")\n"))))
|
||||
(print! (yellow "⚠ Couldn't find package desc for %s" (car spec))))))
|
||||
(print! (green "✓ Package autoloads included"))
|
||||
;; Remove `load-path' and `auto-mode-alist' modifications (most of them,
|
||||
;; at least); they are cached later, so all those membership checks are
|
||||
;; unnecessary overhead.
|
||||
(while (re-search-forward "^\\s-*\\((\\(?:add-to-list\\|\\(?:when\\|if\\) (boundp\\)\\s-+'\\(?:load-path\\|auto-mode-alist\\)\\)" nil t)
|
||||
(goto-char (match-beginning 1))
|
||||
(kill-sexp))
|
||||
(print! (green "✓ Removed load-path/auto-mode-alist entries")))
|
||||
(let (case-fold-search)
|
||||
(save-excursion
|
||||
;; Cache the important and expensive-to-initialize state here.
|
||||
(doom-initialize-packages)
|
||||
(prin1 `(setq load-path ',load-path
|
||||
auto-mode-alist ',auto-mode-alist
|
||||
Info-directory-list ',Info-directory-list
|
||||
doom-disabled-packages ',doom-disabled-packages
|
||||
package-activated-list ',package-activated-list)
|
||||
(current-buffer))
|
||||
(print! (green "✓ Cached package state"))
|
||||
;; insert package autoloads
|
||||
(dolist (spec package-alist)
|
||||
(if-let* ((pkg (car spec))
|
||||
(desc (cadr spec)))
|
||||
(unless (memq pkg doom-autoload-excluded-packages)
|
||||
(let ((file (concat (package--autoloads-file-name desc) ".el")))
|
||||
(when (file-exists-p file)
|
||||
(insert "(let ((load-file-name " (prin1-to-string (abbreviate-file-name file)) "))\n")
|
||||
(insert-file-contents file)
|
||||
(while (re-search-forward "^\\(?:;;\\(.*\n\\)\\|\n\\)" nil t)
|
||||
(unless (nth 8 (syntax-ppss))
|
||||
(replace-match "" t t)))
|
||||
(unless (bolp) (insert "\n"))
|
||||
(insert ")\n"))))
|
||||
(print! (yellow "⚠ Couldn't find package desc for %s" (car spec))))))
|
||||
(print! (green "✓ Package autoloads included"))
|
||||
;; Remove `load-path' and `auto-mode-alist' modifications (most of them,
|
||||
;; at least); they are cached later, so all those membership checks are
|
||||
;; unnecessary overhead.
|
||||
(while (re-search-forward "^\\s-*\\((\\(?:add-to-list\\|\\(?:when\\|if\\) (boundp\\)\\s-+'\\(?:load-path\\|auto-mode-alist\\)\\)" nil t)
|
||||
(goto-char (match-beginning 1))
|
||||
(kill-sexp))
|
||||
(print! (green "✓ Removed load-path/auto-mode-alist entries"))))
|
||||
(doom--byte-compile-file doom-package-autoload-file)
|
||||
(when (and noninteractive (not (daemonp)))
|
||||
(doom--server-load doom-package-autoload-file))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue