all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Pedro" <jpedrodeamorim@gmail.com>
To: 70835@debbugs.gnu.org
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	[thread overview]
Message-ID: <87r0ec13t8.fsf@ergo> (raw)

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	other threads:[~2024-05-08 19:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0ec13t8.fsf@ergo \
    --to=jpedrodeamorim@gmail.com \
    --cc=70835@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.