unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: 62157@debbugs.gnu.org, Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
Subject: bug#62157: More control over the mouse behaviour in eglot
Date: Mon, 13 Mar 2023 16:09:59 +0000	[thread overview]
Message-ID: <CALDnm510C+8TVhLpa20jvQ6Qt2WrxeOuZua9+xOtecZcoBiy1w@mail.gmail.com> (raw)
In-Reply-To: <87lek0vdzd.fsf@gmail.com>

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





  reply	other threads:[~2023-03-13 16:09 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 [this message]
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

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=CALDnm510C+8TVhLpa20jvQ6Qt2WrxeOuZua9+xOtecZcoBiy1w@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=62157@debbugs.gnu.org \
    --cc=paaguti@gmail.com \
    --cc=rpluim@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).