[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 576ea2e 02/54: Unbreak M-x vc-revert, which rever
From: |
João Távora |
Subject: |
[elpa] externals/eglot 576ea2e 02/54: Unbreak M-x vc-revert, which reverts preserving modes |
Date: |
Thu, 16 Apr 2020 05:31:44 -0400 (EDT) |
branch: externals/eglot
commit 576ea2e631d447b5928f38f0642dddba11b02671
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Unbreak M-x vc-revert, which reverts preserving modes
Unlike the normal revert-buffer command, vc-revert, doesn't re-apply
the major mode, meaning it was missing a didOpen to pair with the
didClose that is unconditionally sent on both commands.
Needed to use the dynamic variable revert-buffer-preserve-modes, and,
curiously, also forward-declare it to appease the byte compiler.
* eglot.el (eglot--managed-mode): Use after-revert-hook.
(revert-buffer-preserve-modes): Forward declare.
(eglot--after-revert-hook): Signal didOpen when preserving-modes.
(eglot--maybe-activate-editing-mode): Tweak comment.
---
eglot.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/eglot.el b/eglot.el
index e1c7b48..bd5f1ac 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1214,6 +1214,7 @@ For example, to keep your Company customization use
;; Prepend "didClose" to the hook after the "onoff", so it will run first
(add-hook 'kill-buffer-hook 'eglot--signal-textDocument/didClose nil t)
(add-hook 'before-revert-hook 'eglot--signal-textDocument/didClose nil t)
+ (add-hook 'after-revert-hook 'eglot--after-revert-hook nil t)
(add-hook 'before-save-hook 'eglot--signal-textDocument/willSave nil t)
(add-hook 'after-save-hook 'eglot--signal-textDocument/didSave nil t)
(add-hook 'xref-backend-functions 'eglot-xref-backend nil t)
@@ -1233,6 +1234,7 @@ For example, to keep your Company customization use
(remove-hook 'before-change-functions 'eglot--before-change t)
(remove-hook 'kill-buffer-hook 'eglot--signal-textDocument/didClose t)
(remove-hook 'before-revert-hook 'eglot--signal-textDocument/didClose t)
+ (remove-hook 'after-revert-hook 'eglot--after-revert-hook t)
(remove-hook 'before-save-hook 'eglot--signal-textDocument/willSave t)
(remove-hook 'after-save-hook 'eglot--signal-textDocument/didSave t)
(remove-hook 'xref-backend-functions 'eglot-xref-backend t)
@@ -1286,6 +1288,11 @@ Reset in `eglot--managed-mode-onoff'.")
(defvar-local eglot--unreported-diagnostics nil
"Unreported Flymake diagnostics for this buffer.")
+(defvar revert-buffer-preserve-modes)
+(defun eglot--after-revert-hook ()
+ "Eglot's `after-revert-hook'."
+ (when revert-buffer-preserve-modes (eglot--signal-textDocument/didOpen)))
+
(defun eglot--maybe-activate-editing-mode (&optional server)
"Maybe activate mode function `eglot--managed-mode'.
If SERVER is supplied, do it only if BUFFER is managed by it. In
@@ -1297,7 +1304,8 @@ that case, also signal textDocument/didOpen."
:eglot "`eglot--cached-current-server' is non-nil, but it shouldn't
be!\n\
Please report this as a possible bug.")
(setq eglot--cached-current-server nil)))
- ;; Called even when revert-buffer-in-progress-p
+ ;; Called when `revert-buffer-in-progress-p' is t but
+ ;; `revert-buffer-preserve-modes' is nil.
(let* ((cur (and buffer-file-name (eglot--current-server)))
(server (or (and (null server) cur) (and server (eq server cur)
cur))))
(when server
- [elpa] externals/eglot updated (33a4f86 -> e02479a), João Távora, 2020/04/16
- [elpa] externals/eglot 6dd5de9 05/54: Unbreak imenu, João Távora, 2020/04/16
- [elpa] externals/eglot 243788d 04/54: Force Company to align completion annotations in Eglot sessions, João Távora, 2020/04/16
- [elpa] externals/eglot d5859b5 03/54: Per #319: fix race condition when company-completing quickly, João Távora, 2020/04/16
- [elpa] externals/eglot 576ea2e 02/54: Unbreak M-x vc-revert, which reverts preserving modes,
João Távora <=
- [elpa] externals/eglot 32ba9d0 06/54: Expand README.md section on handling quirky servers, João Távora, 2020/04/16
- [elpa] externals/eglot 3d480d1 01/54: Fix #259 (again): fix issue with replace-buffer-contents, João Távora, 2020/04/16
- [elpa] externals/eglot 83b2acb 09/54: Support markdown for textDocument/hover (#329), João Távora, 2020/04/16
- [elpa] externals/eglot de7631d 17/54: Fix #345: set nobreak-char-display to nil in *eglot-help*, João Távora, 2020/04/16
- [elpa] externals/eglot 179a56d 13/54: Only set eglot--cached-current-server by (more aggressive) caching, João Távora, 2020/04/16
- [elpa] externals/eglot 146108a 15/54: Fix #342: Provide stable eglot-current-server helper, João Távora, 2020/04/16
- [elpa] externals/eglot 8c9078e 19/54: Fix #343: Let other imenu functions work if LSP server's doesn't, João Távora, 2020/04/16
- [elpa] externals/eglot 4bd8773 23/54: Fix #339: fail when eglot-find-* finds no references, João Távora, 2020/04/16
- [elpa] externals/eglot 76d8f49 10/54: Per #50: use completionItem/resolve more abundantly, João Távora, 2020/04/16
- [elpa] externals/eglot a6fa773 25/54: Resolve compilation warnings, João Távora, 2020/04/16