]> git.eshelyaron.com Git - emacs.git/commit
Eglot: beware activation in fundamental-mode
authorJoão Távora <joaotavora@gmail.com>
Thu, 14 Dec 2023 16:32:54 +0000 (16:32 +0000)
committerEshel Yaron <me@eshelyaron.com>
Fri, 15 Dec 2023 20:04:26 +0000 (21:04 +0100)
commita945c971a39cf5dcb818fd6bd21db490586c966e
treea2637e92f1bce80e7cc8fdd7494aaf20adcce11d
parent773509b596391025dedd155d0265bbd0f3371f44
Eglot: beware activation in fundamental-mode

In the specific situation of visiting a buffer via M-. with
eglot-extend-to-xref set to t, it was found that buffer was first
visited in fundamental mode, running after-change-major-mode-hook, and
then again in the proper major mode for the file.  The call to
eglot-current-server of the first visit returned non-nil which cause
two didOpen notifications to be issued for the same file.

Furthermore, in the first call, eglot--languageId to returned nil,
prompting an error from servers such as rust-analyzer.

See also: https://github.com/joaotavora/eglot/discussions/1330

* lisp/progmodes/eglot.el (eglot-current-server): Watch out for
fundamental-mode.

(cherry picked from commit af1fe69f05d803a6958f9d8a045d1013e2ce785c)
lisp/progmodes/eglot.el