branch: elpa/git-commit commit f8353f575e9ed968715a685d69501e5c105f2aee Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-revert-rev-file-buffer: Run major-mode hooks again This reverts [1: f331092df4], 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 #4986. Re #4683. Re doomemacs/doomemacs#6309. 1: 2022-05-08 f331092df4d4dfc0a2a7424d929a9c845088d57f magit-revert-rev-file-buffer: Use delay-mode-hook --- lisp/magit-files.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/magit-files.el b/lisp/magit-files.el index d831c0e759..0d359f4221 100644 --- a/lisp/magit-files.el +++ b/lisp/magit-files.el @@ -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)