]> git.eshelyaron.com Git - emacs.git/commit
Robustify in the face of manual mode changes
authorJoão Távora <joaotavora@gmail.com>
Fri, 20 Jul 2018 16:45:47 +0000 (17:45 +0100)
committerJoão Távora <joaotavora@gmail.com>
Fri, 20 Jul 2018 16:46:44 +0000 (17:46 +0100)
commitc959101180852aa2f46b2e51b21a36a76fcb8052
tree4820b58fda590c8e744c9b78d08450df08b1762d
parent228ddf368de316667905448dca847bb760cf2d73
Robustify in the face of manual mode changes

When manually changing the major-mode of a managed buffer, this sends
a didClose and tears down Eglot-related stuff like if were killing the
buffer.  After changing the mode, we have to recheck that we are now
not managed by another server (or by the same server, in case we
changed the mode to be the same mode).

* eglot.el (eglot-shutdown): Use eglot--with-live-buffer
(eglot--on-shutdown): Use eglot--with-live-buffer
(eglot--managed-mode): Use change-major-mode-hook.
(eglot--managed-mode-onoff): Change protocol. Turn off when called
with no arguments.
(eglot--maybe-activate-editing-mode): Don't do anything if mode is
already active.  Suitable for calling from
after-change-major-mode-hook.
(after-change-major-mode-hook): Add
eglot--maybe-activate-editing-mode.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/44
lisp/progmodes/eglot.el