emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 3ba6b3a 2/2: Speed up byte-compilation and autoload


From: Artur Malabarba
Subject: [Emacs-diffs] master 3ba6b3a 2/2: Speed up byte-compilation and autoload generation by avoiding mode-hooks
Date: Sun, 12 Apr 2015 03:00:45 +0000

branch: master
commit 3ba6b3a9c1e0565ee5f45f11a9c09702a24f8453
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    Speed up byte-compilation and autoload generation by avoiding mode-hooks
    
    This prevents emacs-lisp-mode-hook from being run everytime an
    autoload file is generated, which can account for a fraction of
    package installation time depending on the hooks the user has
    configured.
    
    * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Use delay-mode-hooks.
    
    * lisp/emacs-lisp/autoload.el (autoload-find-file)
    (autoload-find-generated-file): Use delay-mode-hooks.
---
 lisp/emacs-lisp/autoload.el |    7 ++++---
 lisp/emacs-lisp/bytecomp.el |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 073d923..206d5bb 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -235,8 +235,9 @@ If a buffer is visiting the desired autoload file, return 
it."
        (enable-local-eval nil))
     ;; We used to use `raw-text' to read this file, but this causes
     ;; problems when the file contains non-ASCII characters.
-    (find-file-noselect
-     (autoload-ensure-default-file (autoload-generated-file)))))
+    (let ((delay-mode-hooks t))
+      (find-file-noselect
+       (autoload-ensure-default-file (autoload-generated-file))))))
 
 (defun autoload-generated-file ()
   (expand-file-name generated-autoload-file
@@ -400,7 +401,7 @@ which lists the file name and which functions are in it, 
etc."
     (erase-buffer)
     (setq buffer-undo-list t
           buffer-read-only nil)
-    (emacs-lisp-mode)
+    (delay-mode-hooks (emacs-lisp-mode))
     (setq default-directory (file-name-directory file))
     (insert-file-contents file nil)
     (let ((enable-local-variables :safe)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index e929c02..f0d2ee4 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1799,7 +1799,7 @@ The value is non-nil if there were no errors, nil if 
errors."
             (progn
               (setq-default major-mode 'emacs-lisp-mode)
               ;; Arg of t means don't alter enable-local-variables.
-              (normal-mode t))
+              (delay-mode-hooks (normal-mode t)))
           (setq-default major-mode dmm))
         ;; There may be a file local variable setting (bug#10419).
         (setq buffer-read-only nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]