From: Artur Malabarba Date: Sun, 12 Apr 2015 13:37:45 +0000 (+0100) Subject: Use delay-mode-hooks when visiting the init-file X-Git-Tag: emacs-25.0.90~2462 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dfdd7e19446d5fbdbf2211d5ef80ac34655b9f30;p=emacs.git Use delay-mode-hooks when visiting the init-file * lisp/emacs-lisp/package.el (package--ensure-init-file): delay-mode-hooks * lisp/cus-edit.el (custom-save-all): delay-mode-hooks --- diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index f56fb6a649e..9cc2fa81d07 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4406,7 +4406,9 @@ if only the first line of the docstring is shown.")) old-buffer-name) (with-current-buffer (let ((find-file-visit-truename t)) - (or old-buffer (find-file-noselect filename))) + (or old-buffer + (let ((delay-mode-hooks t)) + (find-file-noselect filename)))) ;; We'll save using file-precious-flag, so avoid destroying ;; symlinks. (If we're not already visiting the buffer, this is ;; handled by find-file-visit-truename, above.) @@ -4415,7 +4417,7 @@ if only the first line of the docstring is shown.")) (set-visited-file-name (file-chase-links filename))) (unless (eq major-mode 'emacs-lisp-mode) - (emacs-lisp-mode)) + (delay-mode-hooks (emacs-lisp-mode))) (let ((inhibit-read-only t) (print-length nil) (print-level nil)) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ded2faa54f6..bdb2cc03495 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1778,7 +1778,9 @@ using `package-compute-transaction'." (goto-char (point-min)) (search-forward "(package-initialize)" nil 'noerror))))) (unless contains-init - (with-current-buffer (or buffer (find-file-noselect user-init-file)) + (with-current-buffer (or buffer + (let ((delay-mode-hooks t)) + (find-file-noselect user-init-file))) (save-excursion (save-restriction (widen)