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.
This commit is contained in:
parent
4a0a114505
commit
09eed01afb
3 changed files with 9 additions and 3 deletions
|
@ -497,7 +497,9 @@ If MODE is not set, try to find mode automatically."
|
||||||
(let ((auto-mode-alist
|
(let ((auto-mode-alist
|
||||||
(delq (rassq 'doc-view-mode-maybe auto-mode-alist)
|
(delq (rassq 'doc-view-mode-maybe auto-mode-alist)
|
||||||
(copy-sequence 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)))
|
(setq mode major-mode)))
|
||||||
;; Do not fontify if the guess mode is fundamental.
|
;; Do not fontify if the guess mode is fundamental.
|
||||||
(unless (eq major-mode 'fundamental-mode)
|
(unless (eq major-mode 'fundamental-mode)
|
||||||
|
|
|
@ -2719,7 +2719,9 @@ hunk text is not found in the source file."
|
||||||
(cl-assert (null buffer-file-name))
|
(cl-assert (null buffer-file-name))
|
||||||
(let ((enable-local-variables :safe) ;; to find `mode:'
|
(let ((enable-local-variables :safe) ;; to find `mode:'
|
||||||
(buffer-file-name file))
|
(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?
|
;; FIXME: Is this really worth the trouble?
|
||||||
(when (and (fboundp 'generic-mode-find-file-hook)
|
(when (and (fboundp 'generic-mode-find-file-hook)
|
||||||
(memq #'generic-mode-find-file-hook
|
(memq #'generic-mode-find-file-hook
|
||||||
|
|
|
@ -2098,7 +2098,9 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file."
|
||||||
;; For non-interactive, skip any questions
|
;; For non-interactive, skip any questions
|
||||||
(let ((enable-local-variables :safe) ;; to find `mode:'
|
(let ((enable-local-variables :safe) ;; to find `mode:'
|
||||||
(buffer-file-name file))
|
(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))
|
(normal-mode))
|
||||||
(set-buffer-modified-p nil)
|
(set-buffer-modified-p nil)
|
||||||
(setq buffer-read-only t))
|
(setq buffer-read-only t))
|
||||||
|
|
Loading…
Add table
Reference in a new issue