[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-27 09eed01: Wrap some set-auto-mode calls with delay-mode-hooks (b
From: |
Juri Linkov |
Subject: |
emacs-27 09eed01: Wrap some set-auto-mode calls with delay-mode-hooks (bug#39190) |
Date: |
Wed, 5 Feb 2020 17:39:00 -0500 (EST) |
branch: emacs-27
commit 09eed01afb4968a93247fb8eb7b5301a5bfb6342
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
Wrap some set-auto-mode calls with delay-mode-hooks (bug#39190)
* lisp/gnus/mm-view.el (mm-display-inline-fontify):
* lisp/vc/diff-mode.el (diff-syntax-fontify-props):
* lisp/vc/vc.el (vc-find-revision-no-save):
Add delay-mode-hooks around set-auto-mode calls
to not run hooks that might assume buffer-file-name
really associates buffer with a file.
---
lisp/gnus/mm-view.el | 4 +++-
lisp/vc/diff-mode.el | 4 +++-
lisp/vc/vc.el | 4 +++-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index a6be04e..828ac63 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -497,7 +497,9 @@ If MODE is not set, try to find mode automatically."
(let ((auto-mode-alist
(delq (rassq 'doc-view-mode-maybe auto-mode-alist)
(copy-sequence auto-mode-alist))))
- (set-auto-mode)
+ ;; Don't run hooks that might assume buffer-file-name
+ ;; really associates buffer with a file (bug#39190).
+ (delay-mode-hooks (set-auto-mode))
(setq mode major-mode)))
;; Do not fontify if the guess mode is fundamental.
(unless (eq major-mode 'fundamental-mode)
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 2dbab80..d61c363 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2719,7 +2719,9 @@ hunk text is not found in the source file."
(cl-assert (null buffer-file-name))
(let ((enable-local-variables :safe) ;; to find `mode:'
(buffer-file-name file))
- (set-auto-mode)
+ ;; Don't run hooks that might assume buffer-file-name
+ ;; really associates buffer with a file (bug#39190).
+ (delay-mode-hooks (set-auto-mode))
;; FIXME: Is this really worth the trouble?
(when (and (fboundp 'generic-mode-find-file-hook)
(memq #'generic-mode-find-file-hook
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index f64b6c0..ec252b7 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2098,7 +2098,9 @@ Unlike `vc-find-revision-save', doesn't save the buffer
to the file."
;; For non-interactive, skip any questions
(let ((enable-local-variables :safe) ;; to find `mode:'
(buffer-file-name file))
- (ignore-errors (set-auto-mode)))
+ ;; Don't run hooks that might assume buffer-file-name
+ ;; really associates buffer with a file (bug#39190).
+ (ignore-errors (delay-mode-hooks (set-auto-mode))))
(normal-mode))
(set-buffer-modified-p nil)
(setq buffer-read-only t))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-27 09eed01: Wrap some set-auto-mode calls with delay-mode-hooks (bug#39190),
Juri Linkov <=