From 5295f36115244ab7d99478f021cd52d0ce6f4204 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 10 Jun 2018 20:54:32 +0200 Subject: [PATCH] case-fold-search = nil in reload-package-autoloads Slight optimization. --- core/autoload/modules.el | 67 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/core/autoload/modules.el b/core/autoload/modules.el index 663734743..9d90c7cc6 100644 --- a/core/autoload/modules.el +++ b/core/autoload/modules.el @@ -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))