GNU bug report logs -
#78106
[Feature Request] EGLOT: Optionally make code action indications use mouse clicks
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 78106 in the body.
You can then email your comments to 78106 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Mon, 28 Apr 2025 07:22:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
João Távora <joaotavora <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 28 Apr 2025 07:22:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
They should be mouse clickable, though the margin and fringe are contested
for multiple functions (like opening the Flymake diagnostics buffer when
theres a diagnostic on the line).
So please provide an Emacs -Q recipe for reproducing your problem exactly.
João
On Mon, Apr 28, 2025, 05:21 Elijah Gabe Pérez <eg642616 <at> gmail.com> wrote:
> In the current branch (master), i've noticed the
> addition of `eglot-code-action-indications`.
> However, the indications cannot be clicked,
> for example: If i click any indicator (margins,
> modeline, and others) it should execute
> `eglot-code-actions'.
>
> Maybe there should be an option in
> ˋeglot-code-action-indications` for enable mouse clicks?
>
> Thanks.
> --
> - E.G via GNU Emacs Android port.
>
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Mon, 28 Apr 2025 23:34:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 78106 <at> debbugs.gnu.org (full text, mbox):
João Távora <joaotavora <at> gmail.com> writes:
> They should be mouse clickable, though the margin and fringe are contested for multiple functions (like
> opening the Flymake diagnostics buffer when theres a diagnostic on the line).
>
> So please provide an Emacs -Q recipe for reproducing your problem exactly.
1. Run emacs -Q
2. eval:
(set-window-margins (get-buffer-window) 3)
(setopt eglot-code-action-indications
'(eldoc-hint margin nearby mode-line))
3. Open a file which supports eglot (example: any Emacs C source file) and
enable eglot.
4. Move cursor/point to where there is any code action available.
(for example in any Emacs C source file, move to any DEFUN or macro)
5. And click the 💡 icon where it appears (margin/mode-line/before point).
It doesn't nothing, something curious is that with mode-line/nearby
options the lightbulb icon have a `mouse-face' property, which gives the
impression that you can click it.
--
- E.G via GNU Emacs and Org.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Wed, 30 Apr 2025 14:08:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 78106 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Try clicking with the middle mouse button. It's the same button you use
when clicking a diagnostic that has an action.
João Távora
On Tue, Apr 29, 2025, 00:32 Elijah Gabe Pérez <eg642616 <at> gmail.com> wrote:
> João Távora <joaotavora <at> gmail.com> writes:
>
> > They should be mouse clickable, though the margin and fringe are
> contested for multiple functions (like
> > opening the Flymake diagnostics buffer when theres a diagnostic on the
> line).
> >
> > So please provide an Emacs -Q recipe for reproducing your problem
> exactly.
>
> 1. Run emacs -Q
> 2. eval:
> (set-window-margins (get-buffer-window) 3)
> (setopt eglot-code-action-indications
> '(eldoc-hint margin nearby mode-line))
> 3. Open a file which supports eglot (example: any Emacs C source file) and
> enable eglot.
> 4. Move cursor/point to where there is any code action available.
> (for example in any Emacs C source file, move to any DEFUN or macro)
> 5. And click the 💡 icon where it appears (margin/mode-line/before point).
>
> It doesn't nothing, something curious is that with mode-line/nearby
> options the lightbulb icon have a `mouse-face' property, which gives the
> impression that you can click it.
>
> --
> - E.G via GNU Emacs and Org.
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Wed, 30 Apr 2025 18:09:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 78106 <at> debbugs.gnu.org (full text, mbox):
João Távora <joaotavora <at> gmail.com> writes:
> Try clicking with the middle mouse button. It's the same button you use when clicking a diagnostic that
> has an action.
But it doesn't work for the mode-line if i set
`eglot-code-action-indications' to '(mode-line), mouse-1/2/3 does
nothing there.
Also should not the indicators `help-echo' say something like:
"or mouse-2 for execute code actions at point" too?
--
- E.G via GNU Emacs and Org.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Wed, 30 Apr 2025 18:59:03 GMT)
Full text and
rfc822 format available.
Message #17 received at 78106 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Good ideas. Patches welcome, the shorter the better, of course.
João
On Wed, Apr 30, 2025, 17:56 Elijah Gabe Pérez <eg642616 <at> gmail.com> wrote:
> João Távora <joaotavora <at> gmail.com> writes:
>
> > Try clicking with the middle mouse button. It's the same button you use
> when clicking a diagnostic that
> > has an action.
>
> But it doesn't work for the mode-line if i set
> `eglot-code-action-indications' to '(mode-line), mouse-1/2/3 does
> nothing there.
>
> Also should not the indicators `help-echo' say something like:
> "or mouse-2 for execute code actions at point" too?
>
> --
> - E.G via GNU Emacs and Org.
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Wed, 30 Apr 2025 19:41:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 78106 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
João Távora <joaotavora <at> gmail.com> writes:
> Good ideas. Patches welcome, the shorter the better, of course.
Done:
[0001-Add-keybinding-to-eglot-code-actions-help-echo.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
--
- E.G via GNU Emacs and Org.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Thu, 01 May 2025 10:04:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 78106 <at> debbugs.gnu.org (full text, mbox):
Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:
> João Távora <joaotavora <at> gmail.com> writes:
>
>> Good ideas. Patches welcome, the shorter the better, of course.
>
> Done:
Your ideas are good, but did you test your patch thoroughly? I did, see
comments below.
> (overlay-buffer eglot--suggestion-overlay))
> - (overlay-get eglot--suggestion-overlay 'eglot--suggestion-tooltip)))
> + (eglot--mode-line-props
> + eglot-code-action-indicator
> + 'help-echo
> + `((mouse-1
> + eglot-code-actions-at-mouse
> + ,(plist-get (aref (overlay-get eglot--suggestion-overlay 'eglot--actions) 0) :title)))
> + "Execute code actions at point\n")))
This removes the face from the mode-line indication and uses 'help-echo.
Probably should be eglot-code-action-indicator-face.
Also the blurb looks like.
Execute code actions at point. mouse-1: extract subexpression to variable
Maybe it should be:
mouse-1: execute code actions at point
since your second sentence is misleading, as it will actually pop a
menu, not execute the actual action right away.
> (add-to-list
> @@ -4130,7 +4136,7 @@ eglot-code-action-suggestion
> (when (cl-plusp (length actions))
> (setq blurb
> (substitute-command-keys
> - (eglot--format "\\[eglot-code-actions]: %s"
> + (eglot--format "\\[eglot-code-actions] or
> \\[eglot-code-actions-at-mouse]: %s"
This isn't right, did you test this? The second part shows the user
instructions that when followed do not do what they say they do. For me
it says:
<f2> or M-x eglot-code-actions-at-mouse: extract subexpression to variable
I have M-x eglot-code-actions bound to <f2> of course. In my case it
should say 'mouse-2' as that is the (default) button that pops up a
menu. So it should be
<f2>: extract subexpression to variable, mouse-2: execute code actions
at point
Needless to say if I press 'M-x eglot-code-actions-at-mouse' it doesn't
work, and I get an error saying there is no mouse event when invoking
the command. So substitute-command-keys might not be a solution here,
as you can't easily get it to be aware of the special map and not say
anything if nothing is bound there.
Even more problematic is the fact that it shows the changed blurb in the
ElDoc area, in situations where the mouse (if there even is one!) is not
hovering on the margin or fringe (if there even are fringes).
So this isn't a straightforward problem to solve, which probably
explains why I left this minor detail out.
I also feel that if the code to do this grows too complicated, it's
better to add generic utility to Emacs to solve these problems and
conditionally use it in eglot.el with a 'fboundp' check.
Good luck!
João
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Fri, 02 May 2025 00:05:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 78106 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
João Távora <joaotavora <at> gmail.com> writes:
> Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:
> Your ideas are good, but did you test your patch thoroughly? I did, see
> comments below.
>
>> (overlay-buffer eglot--suggestion-overlay))
>> - (overlay-get eglot--suggestion-overlay 'eglot--suggestion-tooltip)))
>> + (eglot--mode-line-props
>> + eglot-code-action-indicator
>> + 'help-echo
>> + `((mouse-1
>> + eglot-code-actions-at-mouse
>> + ,(plist-get (aref (overlay-get eglot--suggestion-overlay 'eglot--actions) 0) :title)))
>> + "Execute code actions at point\n")))
>
> This removes the face from the mode-line indication and uses 'help-echo.
> Probably should be eglot-code-action-indicator-face.
Oops, sorry, I thought that function was a kind of `propertize'.
> Also the blurb looks like.
>
> Execute code actions at point. mouse-1: extract subexpression to variable
>
> Maybe it should be:
>
> mouse-1: execute code actions at point
>
> since your second sentence is misleading, as it will actually pop a
> menu, not execute the actual action right away.
I agree, fixed.
>> (add-to-list
>> @@ -4130,7 +4136,7 @@ eglot-code-action-suggestion
>> (when (cl-plusp (length actions))
>> (setq blurb
>> (substitute-command-keys
>> - (eglot--format "\\[eglot-code-actions]: %s"
>> + (eglot--format "\\[eglot-code-actions] or
>> \\[eglot-code-actions-at-mouse]: %s"
>
> This isn't right, did you test this? The second part shows the user
> instructions that when followed do not do what they say they do. For me
> it says:
>
> <f2> or M-x eglot-code-actions-at-mouse: extract subexpression to variable
>
> I have M-x eglot-code-actions bound to <f2> of course. In my case it
> should say 'mouse-2' as that is the (default) button that pops up a
> menu. So it should be
>
> <f2>: extract subexpression to variable, mouse-2: execute code actions
> at point
>
> Needless to say if I press 'M-x eglot-code-actions-at-mouse' it doesn't
> work, and I get an error saying there is no mouse event when invoking
> the command. So substitute-command-keys might not be a solution here,
> as you can't easily get it to be aware of the special map and not say
> anything if nothing is bound there.
>
> Even more problematic is the fact that it shows the changed blurb in the
> ElDoc area, in situations where the mouse (if there even is one!) is not
> hovering on the margin or fringe (if there even are fringes).
>
> So this isn't a straightforward problem to solve, which probably
> explains why I left this minor detail out.
>
> I also feel that if the code to do this grows too complicated, it's
> better to add generic utility to Emacs to solve these problems and
> conditionally use it in eglot.el with a 'fboundp' check.
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).
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'.
The help-echo for `margin' and `nearby' now should be displayed as:
"M-x eglot-code-actions: remove #include directive (and 1 more actions),
mouse-2: execute code actions at point"
and for the mode-line: "mouse-1: Execute code actions at point."
[0001-Add-keybinding-to-eglot-code-actions-help-echo.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
--
- E.G via GNU Emacs and Org.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Fri, 02 May 2025 14:01:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 78106 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Fri, 02 May 2025 14:20:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 78106 <at> debbugs.gnu.org (full text, mbox):
> Cc: 78106 <at> debbugs.gnu.org
> From: João Távora <joaotavora <at> gmail.com>
> Date: Fri, 02 May 2025 15:01:02 +0100
>
> Do you have an Emacs copyright assignment?
He does.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Sat, 03 May 2025 01:56:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 78106 <at> debbugs.gnu.org (full text, mbox):
João Távora <joaotavora <at> gmail.com> writes:
>> 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.
It's used only for nearby and margin options:
>> (goto-char (car bounds))
>> - (let ((ov (make-overlay (car bounds) (cadr bounds))))
>> + (let ((ov (make-overlay (car bounds) (cadr bounds)))
>> + (tooltip-1 (propertize
>> + tooltip
>> + 'help-echo
>> + (concat
>> + blurb
>> + ",\nmouse-2: execute code actions at point"))))
>> (overlay-put ov 'eglot--actions actions)
>> (overlay-put ov 'eglot--suggestion-tooltip tooltip)
>> (overlay-put
>> ov
>> 'before-string
>> (cond ((memq 'nearby eglot-code-action-indications)
>> - tooltip)
>> + tooltip-1)
^
>> ((memq 'margin eglot-code-action-indications)
>> (propertize "⚡"
>> 'display
>> `((margin left-margin)
>> - ,tooltip)))))
>> + ,tooltip-1)))))
^
>> (setq eglot--suggestion-overlay ov)))))
Thus, Eldoc will not display "mouse-2: execute code actions at point",
which can be confusing.
> 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.
For now i think that the hardcoded mouse-2 would be the best choice,
also I've seen in other packages (including built-in) that they does the
same.
> 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.")
No problem with this.
> (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-2: execute code actions at point" will appear also in ElDoc.
> '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)
What was 'eglot--suggestion-tooltip' used for? Are you sure it should be
removed?
> (overlay-put
> ov
> 'before-string
>
--
- E.G via GNU Emacs and Org.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Sun, 04 May 2025 07:58:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 78106 <at> debbugs.gnu.org (full text, mbox):
Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:
> João Távora <joaotavora <at> gmail.com> writes:
> It's used only for nearby and margin options:
Yes, and that's where it needs fixing, so no need for a second variable.
>>> + ,tooltip-1)))))
> ^
>>> (setq eglot--suggestion-overlay ov)))))
>
> Thus, Eldoc will not display "mouse-2: execute code actions at point",
> which can be confusing.
Perhaps, but it's even more confusing that if displays that blurb and
the mouse cursor is nowhere near, or there isn't a mouse cursor at all.
> For now i think that the hardcoded mouse-2 would be the best choice,
> also I've seen in other packages (including built-in) that they does the
> same.
I suppose. In fact it's better to have mouse-1, not mouse-2, for the
margin and mode-line, so I changed that. The reason we use mouse-2 for
in-buffer diagnostics overlays is because it's bad practice to rebind
mouse-1 there, whose meaning in an editable buffer should always be
"place point here".
>> (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-2: execute code actions at point" will appear also in ElDoc.
How? I don't see that happening in my testing.
>> '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)
>
> What was 'eglot--suggestion-tooltip' used for? Are you sure it should be
> removed?
I'm fairly sure. It's an internal symbol (as per the '--') and I didn't
catch any references to it. Some left over of the original implementation.
See patch after my sig. If you're content, I can push it:
João
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 474245352d6..d33b0b05fd4 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
@@ -2578,7 +2582,7 @@ eglot--diag-to-lsp-diag
(defvar eglot-diagnostics-map
(let ((map (make-sparse-keymap)))
(define-key map [mouse-2] #'eglot-code-actions-at-mouse)
- (define-key map [left-margin mouse-2] #'eglot-code-actions-at-mouse)
+ (define-key map [left-margin mouse-1] #'eglot-code-actions-at-mouse)
map)
"Keymap active in Eglot-backed Flymake diagnostic overlays.")
@@ -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-1: 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78106
; Package
emacs
.
(Sun, 04 May 2025 21:36:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 78106 <at> debbugs.gnu.org (full text, mbox):
João Távora <joaotavora <at> gmail.com> writes:
> Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:
>
>> For now i think that the hardcoded mouse-2 would be the best choice,
>> also I've seen in other packages (including built-in) that they does the
>> same.
>
> I suppose. In fact it's better to have mouse-1, not mouse-2, for the
> margin and mode-line, so I changed that. The reason we use mouse-2 for
> in-buffer diagnostics overlays is because it's bad practice to rebind
> mouse-1 there, whose meaning in an editable buffer should always be
> "place point here".
I don't have problem with rebinding mouse-2 to mouse-1, so this is fine.
>>> (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-2: execute code actions at point" will appear also in ElDoc.
>
> How? I don't see that happening in my testing.
Then i test it wrongly, I've tested it again, and now it works fine.
> See patch after my sig. If you're content, I can push it:
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index 474245352d6..d33b0b05fd4 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
> @@ -2578,7 +2582,7 @@ eglot--diag-to-lsp-diag
> (defvar eglot-diagnostics-map
> (let ((map (make-sparse-keymap)))
> (define-key map [mouse-2] #'eglot-code-actions-at-mouse)
> - (define-key map [left-margin mouse-2] #'eglot-code-actions-at-mouse)
> + (define-key map [left-margin mouse-1] #'eglot-code-actions-at-mouse)
> map)
> "Keymap active in Eglot-backed Flymake diagnostic overlays.")
>
> @@ -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-1: 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
>
Nothing wrong here, so this can be pushed.
--
- E.G via GNU Emacs and Org.
Reply sent
to
João Távora <joaotavora <at> gmail.com>
:
You have taken responsibility.
(Tue, 06 May 2025 10:00:08 GMT)
Full text and
rfc822 format available.
Notification sent
to
João Távora <joaotavora <at> gmail.com>
:
bug acknowledged by developer.
(Tue, 06 May 2025 10:00:08 GMT)
Full text and
rfc822 format available.
Message #46 received at 78106-done <at> debbugs.gnu.org (full text, mbox):
Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:
> Nothing wrong here, so this can be pushed.
Done, and closing.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 03 Jun 2025 11:24:20 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.