unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: 62157-done@debbugs.gnu.org, "João Távora" <joaotavora@gmail.com>
Subject: bug#62157: More control over the mouse behaviour in eglot
Date: Tue, 12 Sep 2023 07:23:05 +0200	[thread overview]
Message-ID: <E0AC50B1-F028-42C2-9AF6-E15AD51A845D@gmail.com> (raw)
In-Reply-To: <CADwFkmn6ppD-EX4JQNhEjOUp-NyW9OFeGo-VpqBb5fTZh5tjnw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3335 bytes --]

Just to confirm that the issue was solved (at least for me)

/PA

> El 12 sept 2023, a las 2:22, Stefan Kangas <stefankangas@gmail.com> escribió:
> 
> João Távora <joaotavora@gmail.com> writes:
> 
>> On Mon, Mar 13, 2023 at 7:22 AM Pedro Andres Aranda Gutierrez
>> <paaguti@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.


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4482 bytes --]

  reply	other threads:[~2023-09-12  5:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13  7:20 bug#62157: More control over the mouse behaviour in eglot Pedro Andres Aranda Gutierrez
2023-03-13 15:47 ` João Távora
2023-03-13 15:59   ` Robert Pluim
2023-03-13 16:09     ` João Távora
2023-03-13 16:36       ` Robert Pluim
2023-09-12  0:22   ` Stefan Kangas
2023-09-12  5:23     ` Pedro Andres Aranda Gutierrez [this message]
2023-09-12  7:07     ` João Távora
2023-09-13 16:12       ` Stefan Kangas

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=E0AC50B1-F028-42C2-9AF6-E15AD51A845D@gmail.com \
    --to=paaguti@gmail.com \
    --cc=62157-done@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=stefankangas@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).