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 #14 received at 62157 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 62157 <at> debbugs.gnu.org, Pedro Andres Aranda Gutierrez <paaguti <at> gmail.com>
Subject: Re: bug#62157: More control over the mouse behaviour in eglot
Date: Mon, 13 Mar 2023 16:09:59 +0000
On Mon, Mar 13, 2023 at 3:59 PM Robert Pluim <rpluim <at> gmail.com> wrote:
>
> >>>>> On Mon, 13 Mar 2023 15:47:38 +0000, João Távora <joaotavora <at> 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




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.