GNU bug report logs - #78106
[Feature Request] EGLOT: Optionally make code action indications use mouse clicks

Previous Next

Package: emacs;

Reported by: João Távora <joaotavora <at> gmail.com>

Date: Mon, 28 Apr 2025 07:22:01 UTC

Severity: wishlist

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 78106 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>
Cc: 78106 <at> debbugs.gnu.org
Subject: Re: bug#78106: [Feature Request] EGLOT: Optionally make code action
 indications use mouse clicks
Date: Fri, 02 May 2025 15:01:02 +0100
Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:

> A way I found for achieve this is only (re)propertizing the blurb
> help-echo for `margin' and `nearby' options (like the patch below).
> This let eldoc area unchanged (i tested it).

Good, I think we're getting closer.

> I used `substitute-command-keys' only for get the mouse-1/2/3 button for
> margin, but since i see this is problematic, I've changed it to only
> display `mouse-2'.

Yes, this is a problem.  Maybe we should just let the hardcoded mouse-2
be there, or maybe there is a better way.  Anyway, please proceed from
the simpler patch after my sig.  I noticed the 'tooltip' (sans "1")
variable wasn't being used for anything.

I think that -- ideally, at least on Emacs master -- there should be a
way to tell substitute-command-keys which parts of the Emacs layout to
consider when constructing its strings.  Feel free to ask about this on
emacs-devel and then bring any results back to Eglot.  If we can't find
anything better I'll commit some version of your patch (with due credit
to you, of course).

Do you have an Emacs copyright assignment?  Your patch is "trivial", but
it would be good it you had one of these.

João

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index d796c9fc802..8d2934391d6 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2531,7 +2531,11 @@ eglot-mode-line-action-suggestion
   '(:eval
     (when (and (memq 'mode-line eglot-code-action-indications)
                (overlay-buffer eglot--suggestion-overlay))
-      (overlay-get eglot--suggestion-overlay 'eglot--suggestion-tooltip)))
+      (eglot--mode-line-props
+       eglot-code-action-indicator 'eglot-code-action-indicator-face
+       `((mouse-1
+          eglot-code-actions-at-mouse
+          "execute code actions at point")))))
   "Eglot mode line construct for at-point code actions.")
 
 (add-to-list
@@ -4146,14 +4150,13 @@ eglot-code-action-suggestion
              (setq tooltip
                    (propertize eglot-code-action-indicator
                                'face 'eglot-code-action-indicator-face
-                               'help-echo blurb
+                               'help-echo "mouse-2: execute code actions at point"
                                'mouse-face 'highlight
                                'keymap eglot-diagnostics-map))
              (save-excursion
                (goto-char (car bounds))
                (let ((ov (make-overlay (car bounds) (cadr bounds))))
                  (overlay-put ov 'eglot--actions actions)
-                 (overlay-put ov 'eglot--suggestion-tooltip tooltip)
                  (overlay-put
                   ov
                   'before-string




This bug report was last modified 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.