1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

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
This commit is contained in:
Artur Malabarba 2015-04-12 14:37:45 +01:00
parent 5fb807efcd
commit dfdd7e1944
2 changed files with 7 additions and 3 deletions

View File

@ -4406,7 +4406,9 @@ if only the first line of the docstring is shown."))
old-buffer-name) old-buffer-name)
(with-current-buffer (let ((find-file-visit-truename t)) (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 ;; We'll save using file-precious-flag, so avoid destroying
;; symlinks. (If we're not already visiting the buffer, this is ;; symlinks. (If we're not already visiting the buffer, this is
;; handled by find-file-visit-truename, above.) ;; 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))) (set-visited-file-name (file-chase-links filename)))
(unless (eq major-mode 'emacs-lisp-mode) (unless (eq major-mode 'emacs-lisp-mode)
(emacs-lisp-mode)) (delay-mode-hooks (emacs-lisp-mode)))
(let ((inhibit-read-only t) (let ((inhibit-read-only t)
(print-length nil) (print-length nil)
(print-level nil)) (print-level nil))

View File

@ -1778,7 +1778,9 @@ using `package-compute-transaction'."
(goto-char (point-min)) (goto-char (point-min))
(search-forward "(package-initialize)" nil 'noerror))))) (search-forward "(package-initialize)" nil 'noerror)))))
(unless contains-init (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-excursion
(save-restriction (save-restriction
(widen) (widen)