unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70958: 30.0.50; eglot-managed-mode hooks not called on shutdown
@ 2024-05-15 12:38 Troy Brown
  2024-05-25  7:53 ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Troy Brown @ 2024-05-15 12:38 UTC (permalink / raw)
  To: 70958

The documentation for eglot-managed-mode-hook indicates that the hook
is run after Eglot has started/stopped managing a buffer.  I was
trying to use this to perform setup/teardown of functionality when
this happened, but it appears the registered hooks are never called on
shutdown.  The following is a little test that can be run in a buffer
which has LSP support, to demonstrate the problem.  My expectation is
that "Buffer not managed" is output and the my-eglot-hook-var is
changed to 'not-managed when a shutdown occurs.

--8<---------------cut here---------------start------------->8---
(defun my-eglot-test ()
  (defun my-eglot-hook ()
    (message "my-eglot-hook invoked")
    (if (eglot-managed-p)
        (progn
          (message "Buffer is managed")
          (setq-local my-eglot-hook-var 'managed))
      (message "Buffer not managed")
      (setq-local my-eglot-hook-var 'not-managed)))
  (add-hook 'eglot-managed-mode-hook #'my-eglot-hook)
  (setq-local my-eglot-hook-var 'initial)
  (cl-assert (not (eglot-managed-p)))
  (cl-assert (eq my-eglot-hook-var 'initial))
  (call-interactively #'eglot)
  (cl-assert (eglot-managed-p))
  (cl-assert (eq my-eglot-hook-var 'managed))
  (sleep-for 3) ; wait for server connection
  (call-interactively #'eglot-shutdown)
  (cl-assert (not (eglot-managed-p)))
  (cl-assert (eq my-eglot-hook-var 'not-managed)))
--8<---------------cut here---------------end--------------->8---





^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-06-01 16:01 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15 12:38 bug#70958: 30.0.50; eglot-managed-mode hooks not called on shutdown Troy Brown
2024-05-25  7:53 ` Eli Zaretskii
2024-05-26 22:46   ` João Távora
2024-05-27 12:29     ` Troy Brown
2024-05-27 12:35       ` João Távora
2024-05-27 12:45         ` Troy Brown
2024-05-27 14:09           ` João Távora
2024-05-27 14:32             ` Troy Brown
2024-05-27 15:45               ` João Távora
2024-05-27 15:51                 ` João Távora
2024-05-27 16:21     ` Felician Nemeth
2024-05-27 17:22       ` João Távora
2024-05-27 17:35         ` Felician Nemeth
2024-05-27 21:05           ` João Távora
2024-05-27 22:21             ` João Távora
2024-05-28 13:00               ` Troy Brown
2024-06-01 14:18                 ` Eli Zaretskii
     [not found]                   ` <CALDnm507yRL6y6VcM-OwHUhSmFbpcFhsUb00wabirPkfq7ZAow@mail.gmail.com>
2024-06-01 16:01                     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).