Skip to content

Commit

Permalink
magit-revert-rev-file-buffer: Run major-mode hooks again
Browse files Browse the repository at this point in the history
This reverts [1: f331092], which disabled it for the benefit of
`lsp', which does something that isn't compatible with what we are
doing here.

At least for the time being, advice the `lsp' function instead,
which I have been told, also works around the incompatibility.

Fixes magit#4986.
Re magit#4683.
Re doomemacs/doomemacs#6309.

1: 2022-05-08 f331092
   magit-revert-rev-file-buffer: Use delay-mode-hook
  • Loading branch information
tarsius committed Aug 21, 2023
1 parent 6f54443 commit f8353f5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lisp/magit-files.el
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,19 @@ then only after asking. A non-nil value for REVERT is ignored if REV is
(after-change-major-mode-hook
(remq 'global-diff-hl-mode-enable-in-buffers
after-change-major-mode-hook)))
(delay-mode-hooks
(normal-mode t)))
(normal-mode t))
(setq buffer-read-only t)
(set-buffer-modified-p nil)
(goto-char (point-min))))

(defun magit--lsp--disable-when-visiting-blob (fn &rest args)
"Do nothing when visiting blob using `magit-find-file' and similar.
See also https://github.com/doomemacs/doomemacs/pull/6309."
(unless magit-buffer-revision
(apply fn args)))

(advice-add 'lsp :around #'magit--lsp--disable-when-visiting-blob)

;;; Find Index

(defvar magit-find-index-hook nil)
Expand Down

0 comments on commit f8353f5

Please sign in to comment.