bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#70835: eglot-managed-mode-hook doesn't run when minor mode is turned


From: João Pedro
Subject: bug#70835: eglot-managed-mode-hook doesn't run when minor mode is turned off
Date: Wed, 08 May 2024 16:50:11 -0300

As the title says, the public facing `eglot-managed-mode-hook' doesn't
run when `eglot--managed-mode' is turned off. That can be tested with

    (add-hook 'eglot-managed-mode-hook
              (lambda ()
                (message "ran eglot-managed-mode-hook with eglot--managed-mode 
'%s'"
                         (if eglot--managed-mode "on" "off"))))

    (add-hook 'eglot--managed-mode-hook
              (lambda ()
                (message "ran eglot--managed-mode-hook with eglot--managed-mode 
'%s'"
                         (if eglot--managed-mode "on" "off"))))

In fact, as of Eglot version 1.17, that is caused by the following

    (defun eglot--maybe-activate-editing-mode ()
      "Maybe activate `eglot--managed-mode'.

    If it is activated, also signal textDocument/didOpen."
      (unless eglot--managed-mode
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ;; Called when `revert-buffer-in-progress-p' is t but
        ;; `revert-buffer-preserve-modes' is nil.
        (when (and buffer-file-name (eglot-current-server))
          (setq eglot--diagnostics nil)
          (eglot--managed-mode)
          (eglot--signal-textDocument/didOpen)
          ;; Run user hook after 'textDocument/didOpen' so server knows
          ;; about the buffer.
          (eglot-inlay-hints-mode 1)
          (run-hooks 'eglot-managed-mode-hook))))

Calling run-hooks inside the definition of eglot--managed-mode, but I'm
not sure.

Best,

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]