[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/magit 234a787b8c 1/3: magit-revert-rev-file-buffer: Avoid
From: |
Jonas Bernoulli |
Subject: |
[nongnu] elpa/magit 234a787b8c 1/3: magit-revert-rev-file-buffer: Avoid Eglot |
Date: |
Sun, 22 Sep 2024 18:06:07 -0400 (EDT) |
branch: elpa/magit
commit 234a787b8caebbbbd647ed59a8cc519211ffd827
Author: Pengji Zhang <me@pengjiz.com>
Commit: Pengji Zhang <me@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 09947a013f..f8503c7890 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)