* bug#62157: More control over the mouse behaviour in eglot @ 2023-03-13 7:20 Pedro Andres Aranda Gutierrez 2023-03-13 15:47 ` João Távora 0 siblings, 1 reply; 9+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2023-03-13 7:20 UTC (permalink / raw) To: 62157 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. -- Fragen sind nicht da um beantwortet zu werden, Fragen sind da um gestellt zu werden Georg Kreisler Headaches with a Juju log: unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run a leader-deposed hook here, but we can't yet ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#62157: More control over the mouse behaviour in eglot 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-09-12 0:22 ` Stefan Kangas 0 siblings, 2 replies; 9+ messages in thread From: João Távora @ 2023-03-13 15:47 UTC (permalink / raw) To: Pedro Andres Aranda Gutierrez; +Cc: 62157 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 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* bug#62157: More control over the mouse behaviour in eglot 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-09-12 0:22 ` Stefan Kangas 1 sibling, 1 reply; 9+ messages in thread From: Robert Pluim @ 2023-03-13 15:59 UTC (permalink / raw) To: João Távora; +Cc: 62157, Pedro Andres Aranda Gutierrez >>>>> On Mon, 13 Mar 2023 15:47:38 +0000, João Távora <joaotavora@gmail.com> said: João> Can you try this patch? It also changes the default binding to João> [mouse-2]. I think you meant 'mouse-2', but you typed 'mouse-1' in the patch. João> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el João> index 2491c86ea5b..256b4cd93ba 100644 João> --- a/lisp/progmodes/eglot.el João> +++ b/lisp/progmodes/eglot.el João> @@ -2084,15 +2084,18 @@ eglot--mode-line-format João> (defalias 'eglot--make-diag 'flymake-make-diagnostic) João> (defalias 'eglot--diag-data 'flymake-diagnostic-data) João> +(defvar eglot-diagnostics-map João> + "Map active in Eglot-backed Flymake diagnostic overlays." João> + (let ((map (make-sparse-keymap))) João> + (define-key map [mouse-1] 'eglot-code-actions-at-mouse) João> + map)) João> + Iʼm guessing eglot is not yet using `defvar-keymap' because of backwards compatibility? In any case, this doesnʼt make the binding easily changable, you have to manually unset/set the `eglot-code-actions-at-mouse' binding. My attempt to fix this descended into a circular dependency spiral between the keymap and the key defcustom, so Iʼm hoping you know a good way to do it :-) Robert -- ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#62157: More control over the mouse behaviour in eglot 2023-03-13 15:59 ` Robert Pluim @ 2023-03-13 16:09 ` João Távora 2023-03-13 16:36 ` Robert Pluim 0 siblings, 1 reply; 9+ messages in thread From: João Távora @ 2023-03-13 16:09 UTC (permalink / raw) To: Robert Pluim; +Cc: 62157, Pedro Andres Aranda Gutierrez On Mon, Mar 13, 2023 at 3:59 PM Robert Pluim <rpluim@gmail.com> wrote: > > >>>>> On Mon, 13 Mar 2023 15:47:38 +0000, João Távora <joaotavora@gmail.com> said: > João> Can you try this patch? It also changes the default binding to > João> [mouse-2]. > > I think you meant 'mouse-2', but you typed 'mouse-1' in the patch. Yes, sorry. > João> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el > João> index 2491c86ea5b..256b4cd93ba 100644 > João> --- a/lisp/progmodes/eglot.el > João> +++ b/lisp/progmodes/eglot.el > João> @@ -2084,15 +2084,18 @@ eglot--mode-line-format > João> (defalias 'eglot--make-diag 'flymake-make-diagnostic) > João> (defalias 'eglot--diag-data 'flymake-diagnostic-data) > > João> +(defvar eglot-diagnostics-map > João> + "Map active in Eglot-backed Flymake diagnostic overlays." > João> + (let ((map (make-sparse-keymap))) > João> + (define-key map [mouse-1] 'eglot-code-actions-at-mouse) > João> + map)) > João> + > > Iʼm guessing eglot is not yet using `defvar-keymap' because of > backwards compatibility? I'd think so yes. > In any case, this doesnʼt make the binding easily changable, you have > to manually unset/set the `eglot-code-actions-at-mouse' binding. My > attempt to fix this descended into a circular dependency spiral > between the keymap and the key defcustom, so Iʼm hoping you know a > good way to do it :-) A key defcustom isn't needed IMO. You may even want multiple bindings there. 99% percent of users will like the default bindings, the others can (define-key eglot-diagnostics-map [mouse-2] nil) or (unbind-key [mouse-1] eglot-diagnostics-map) which I don't know if exists in older Emacsen. João ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#62157: More control over the mouse behaviour in eglot 2023-03-13 16:09 ` João Távora @ 2023-03-13 16:36 ` Robert Pluim 0 siblings, 0 replies; 9+ messages in thread From: Robert Pluim @ 2023-03-13 16:36 UTC (permalink / raw) To: João Távora; +Cc: 62157, Pedro Andres Aranda Gutierrez >>>>> On Mon, 13 Mar 2023 16:09:59 +0000, João Távora <joaotavora@gmail.com> said: >> In any case, this doesnʼt make the binding easily changable, you have >> to manually unset/set the `eglot-code-actions-at-mouse' binding. My >> attempt to fix this descended into a circular dependency spiral >> between the keymap and the key defcustom, so Iʼm hoping you know a >> good way to do it :-) João> A key defcustom isn't needed IMO. You may even want multiple João> bindings there. 99% percent of users will like the default João> bindings, the others can OK. We can always add it if people ask for it. João> (define-key eglot-diagnostics-map [mouse-2] nil) João> or João> (unbind-key [mouse-1] eglot-diagnostics-map) João> which I don't know if exists in older Emacsen. I think itʼs an emacs-29 thing. Although it does look kind of redundant with `keymap-unset' (which is also new in emacs-29) :-) Robert -- ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#62157: More control over the mouse behaviour in eglot 2023-03-13 15:47 ` João Távora 2023-03-13 15:59 ` Robert Pluim @ 2023-09-12 0:22 ` Stefan Kangas 2023-09-12 5:23 ` Pedro Andres Aranda Gutierrez 2023-09-12 7:07 ` João Távora 1 sibling, 2 replies; 9+ messages in thread From: Stefan Kangas @ 2023-09-12 0:22 UTC (permalink / raw) To: João Távora; +Cc: 62157-done, Pedro Andres Aranda Gutierrez 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. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#62157: More control over the mouse behaviour in eglot 2023-09-12 0:22 ` Stefan Kangas @ 2023-09-12 5:23 ` Pedro Andres Aranda Gutierrez 2023-09-12 7:07 ` João Távora 1 sibling, 0 replies; 9+ messages in thread From: Pedro Andres Aranda Gutierrez @ 2023-09-12 5:23 UTC (permalink / raw) To: Stefan Kangas; +Cc: 62157-done, João Távora [-- 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 --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#62157: More control over the mouse behaviour in eglot 2023-09-12 0:22 ` Stefan Kangas 2023-09-12 5:23 ` Pedro Andres Aranda Gutierrez @ 2023-09-12 7:07 ` João Távora 2023-09-13 16:12 ` Stefan Kangas 1 sibling, 1 reply; 9+ messages in thread From: João Távora @ 2023-09-12 7:07 UTC (permalink / raw) To: Stefan Kangas; +Cc: 62157-done, Pedro Andres Aranda Gutierrez On Tue, Sep 12, 2023 at 1:22 AM Stefan Kangas <stefankangas@gmail.com> wrote: > 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. The conclusion is quite correct, and I earlier meant to close the bug, but due to typical incompetence when copy-pasting in my brain sent mail to 61257-done@debbugs.gnu.org instead. So maybe check if that other bug hasn't been closed in error :-) João ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#62157: More control over the mouse behaviour in eglot 2023-09-12 7:07 ` João Távora @ 2023-09-13 16:12 ` Stefan Kangas 0 siblings, 0 replies; 9+ messages in thread From: Stefan Kangas @ 2023-09-13 16:12 UTC (permalink / raw) To: João Távora; +Cc: 62157-done, Pedro Andres Aranda Gutierrez João Távora <joaotavora@gmail.com> writes: > The conclusion is quite correct, and I earlier meant to close the bug, > but due to typical incompetence when copy-pasting in my brain > sent mail to 61257-done@debbugs.gnu.org instead. So maybe check > if that other bug hasn't been closed in error :-) I took a look and that bug seems to be fine. It belongs to guix-patches. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-09-13 16:12 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 2023-09-12 7:07 ` João Távora 2023-09-13 16:12 ` Stefan Kangas
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).