Skip to content

Commit 09eed01

Browse files
committed
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.
1 parent 4a0a114 commit 09eed01

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

lisp/gnus/mm-view.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,9 @@ If MODE is not set, try to find mode automatically."
497497
(let ((auto-mode-alist
498498
(delq (rassq 'doc-view-mode-maybe auto-mode-alist)
499499
(copy-sequence auto-mode-alist))))
500-
(set-auto-mode)
500+
;; Don't run hooks that might assume buffer-file-name
501+
;; really associates buffer with a file (bug#39190).
502+
(delay-mode-hooks (set-auto-mode))
501503
(setq mode major-mode)))
502504
;; Do not fontify if the guess mode is fundamental.
503505
(unless (eq major-mode 'fundamental-mode)

lisp/vc/diff-mode.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2719,7 +2719,9 @@ hunk text is not found in the source file."
27192719
(cl-assert (null buffer-file-name))
27202720
(let ((enable-local-variables :safe) ;; to find `mode:'
27212721
(buffer-file-name file))
2722-
(set-auto-mode)
2722+
;; Don't run hooks that might assume buffer-file-name
2723+
;; really associates buffer with a file (bug#39190).
2724+
(delay-mode-hooks (set-auto-mode))
27232725
;; FIXME: Is this really worth the trouble?
27242726
(when (and (fboundp 'generic-mode-find-file-hook)
27252727
(memq #'generic-mode-find-file-hook

lisp/vc/vc.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2098,7 +2098,9 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file."
20982098
;; For non-interactive, skip any questions
20992099
(let ((enable-local-variables :safe) ;; to find `mode:'
21002100
(buffer-file-name file))
2101-
(ignore-errors (set-auto-mode)))
2101+
;; Don't run hooks that might assume buffer-file-name
2102+
;; really associates buffer with a file (bug#39190).
2103+
(ignore-errors (delay-mode-hooks (set-auto-mode))))
21022104
(normal-mode))
21032105
(set-buffer-modified-p nil)
21042106
(setq buffer-read-only t))

0 commit comments

Comments
 (0)