GNU bug report logs - #62157
More control over the mouse behaviour in eglot

Previous Next

Package: emacs;

Reported by: Pedro Andres Aranda Gutierrez <paaguti <at> gmail.com>

Date: Mon, 13 Mar 2023 07:22:01 UTC

Severity: normal

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #25 received at 62157-done <at> debbugs.gnu.org (full text, mbox):

From: Pedro Andres Aranda Gutierrez <paaguti <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 62157-done <at> debbugs.gnu.org,
 João Távora <joaotavora <at> gmail.com>
Subject: Re: bug#62157: More control over the mouse behaviour in eglot
Date: Tue, 12 Sep 2023 07:23:05 +0200
[Message part 1 (text/plain, inline)]
Just to confirm that the issue was solved (at least for me)

/PA

> El 12 sept 2023, a las 2:22, Stefan Kangas <stefankangas <at> gmail.com> escribió:
> 
> João Távora <joaotavora <at> gmail.com> writes:
> 
>> On Mon, Mar 13, 2023 at 7:22 AM Pedro Andres Aranda Gutierrez
>> <paaguti <at> gmail.com> wrote:
>>> 
>>> When I edit Python with eglot,  mouse-1-down opens the eglot code
>>> actions menu when over a place where there is a possible action. I'd
>>> like to be able to define the mouse event to open the menu myself. In
>>> the same line, I'd like to control the items on the code actions mouse
>>> menu.
>> 
>> These are two separate requests.  I'll focus on the first one,
>> as the second one is obscure.  It probablyneeds its own separate
>> issue describing a reproducible observable example of what "item
>> control" is desired.
>> 
>> So, having mouse-1 for the binding to get code actions in diagnostics
>> is indeed not good, because it prevents point from being put on
>> a certain character using mouse-1, which should really nothappen.
>> 
>> Currently, to configure it, the user must place a certain property on
>> the symbols eglot-note eglot-warning eglot-error, which is not
>> easy at all.
>> 
>> Can you try this patch?  It also changes the default binding to
>> [mouse-2].
>> 
>> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
>> index 2491c86ea5b..256b4cd93ba 100644
>> --- a/lisp/progmodes/eglot.el
>> +++ b/lisp/progmodes/eglot.el
>> @@ -2084,15 +2084,18 @@ eglot--mode-line-format
>> (defalias 'eglot--make-diag 'flymake-make-diagnostic)
>> (defalias 'eglot--diag-data 'flymake-diagnostic-data)
>> 
>> +(defvar eglot-diagnostics-map
>> +  "Map active in Eglot-backed Flymake diagnostic overlays."
>> +  (let ((map (make-sparse-keymap)))
>> +    (define-key map [mouse-1] 'eglot-code-actions-at-mouse)
>> +    map))
>> +
>> (cl-loop for i from 1
>>          for type in '(eglot-note eglot-warning eglot-error)
>>          do (put type 'flymake-overlay-control
>>                  `((mouse-face . highlight)
>>                    (priority . ,(+ 50 i))
>> -                   (keymap . ,(let ((map (make-sparse-keymap)))
>> -                                (define-key map [mouse-1]
>> -                                            (eglot--mouse-call
>> 'eglot-code-actions))
>> -                                map)))))
>> +                   (keymap . ,eglot-diagnostics-map))))
>> 
>> 
>> ;;; Protocol implementation (Requests, notifications, etc)
>> @@ -3335,6 +3338,9 @@ eglot-code-actions
>>         (eglot--read-execute-code-action actions server action-kind)
>>       actions)))
>> 
>> +(defalias 'eglot-code-actions-at-mouse (eglot--mouse-call 'eglot-code-actions)
>> +  "Like `eglot-code-actions', but intended for mouse events.")
>> +
>> (defun eglot--read-execute-code-action (actions server &optional action-kind)
>>   "Helper for interactive calls to `eglot-code-actions'."
>>   (let* ((menu-items
>> 
>> João
> 
> It seems like the fix was the patch above, which IIUC has been
> installed.  I'm therefore closing this bug report.
> 
> If this conclusion is incorrect and this is still an issue, please reply
> to this email (use "Reply to all" in your email client) and we can
> reopen the bug report.

[smime.p7s (application/pkcs7-signature, attachment)]

This bug report was last modified 1 year and 252 days ago.

Previous Next


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