branch: elpa/magit commit 234a787b8caebbbbd647ed59a8cc519211ffd827 Author: Pengji Zhang <m...@pengjiz.com> Commit: Pengji Zhang <m...@pengjiz.com>
magit-revert-rev-file-buffer: Avoid Eglot Eglot may be activated for buffers visiting blobs like lsp-mode, and most LSP servers bail out in that case. So in this commit we remove the activation function from the relevant hook. Note that when started, Eglot checks and attempts to manage existing buffers as well. However, at that point, buffers visiting blobs have 'buffer-file-name' being nil, and Eglot will ignore them. So we only need to modify the hook instead of advising the function. This is to achieve the same effect as the advice for 'lsp', introduced in [1: f8353f57]. 1: 2023-08-21 f8353f575e9ed968715a685d69501e5c105f2aee magit-revert-rev-file-buffer: Run major-mode hooks again --- lisp/magit-files.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/magit-files.el b/lisp/magit-files.el index 09947a013fc..f8503c78909 100644 --- a/lisp/magit-files.el +++ b/lisp/magit-files.el @@ -177,8 +177,10 @@ then only after asking. A non-nil value for REVERT is ignored if REV is (setq buffer-file-coding-system last-coding-system-used)) (let ((buffer-file-name magit-buffer-file-name) (after-change-major-mode-hook - (remq 'global-diff-hl-mode-enable-in-buffers - after-change-major-mode-hook))) + (seq-difference after-change-major-mode-hook + '(global-diff-hl-mode-enable-in-buffers + eglot--maybe-activate-editing-mode) + #'eq))) (normal-mode t)) (setq buffer-read-only t) (set-buffer-modified-p nil)