From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#62157: More control over the mouse behaviour in eglot Date: Mon, 11 Sep 2023 17:22:41 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18913"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62157-done@debbugs.gnu.org, Pedro Andres Aranda Gutierrez To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 12 02:23:18 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qfrBW-0004iH-94 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Sep 2023 02:23:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfrBE-0002Jw-7M; Mon, 11 Sep 2023 20:23:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfrBC-0002JY-GB for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 20:22:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfrBC-0001aC-7p for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 20:22:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfrBG-0001EF-HE for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 20:23:02 -0400 Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Sep 2023 00:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 62157 X-GNU-PR-Package: emacs Mail-Followup-To: 62157@debbugs.gnu.org, stefankangas@gmail.com, paaguti@gmail.com Original-Received: via spool by 62157-done@debbugs.gnu.org id=D62157.16944781794710 (code D ref 62157); Tue, 12 Sep 2023 00:23:02 +0000 Original-Received: (at 62157-done) by debbugs.gnu.org; 12 Sep 2023 00:22:59 +0000 Original-Received: from localhost ([127.0.0.1]:55392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfrBC-0001Dt-Ho for submit@debbugs.gnu.org; Mon, 11 Sep 2023 20:22:58 -0400 Original-Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]:54555) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfrB6-0001DX-Be for 62157-done@debbugs.gnu.org; Mon, 11 Sep 2023 20:22:57 -0400 Original-Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2bce552508fso83166301fa.1 for <62157-done@debbugs.gnu.org>; Mon, 11 Sep 2023 17:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694478162; x=1695082962; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=EdTD9RoolnVOy4ipKRuaZ4SWBS3jQerPf6tF/ouMJB8=; b=rdCSGt+cKo15TcBxv9f8uKASPlW9dvw3dRj2mB0dvWteckWhbJ2wy87qfYrio3LYR2 +PGPSnDIeqMj2Zh6BmkCzoBpcX2Pxziwi/2JPM6L+YIVG87TjwUs3GqeBBWnRem4b0ER JtLtliV0vh4tN8/NqS7k7iTRoMiJ/w8ZeaWUEdjBSjMJhFc+frwinPCI9WXViJGxa8f8 Xp8EwOdJSxq7ktdkOUR5rO8L8hqgOObjwgm+v+dhJkBWbfmfwvbwl/0TCbaHV98VLP8p PA53kbzJkGup4H60q8JoexLAV8ZtNFP+YrZAea0MJHFZlTPGT9nmKxbGADW0xn9BgrHR LU2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694478162; x=1695082962; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=EdTD9RoolnVOy4ipKRuaZ4SWBS3jQerPf6tF/ouMJB8=; b=Z2M4VajnKnpRZ0BNBtx5DZBhDL7MDV17hZQFnrm+YkflDi/mho7RdUipTQeRDes/hQ gUygbTeelLaMCFLh1LybyMM8fMgaRcJz8uxkSGr8xHPjdAzLLbvIsHU3wH98D4gl8lZ6 WEOxaFDKbalsWyKBADdCN7VnBboqfg/Q9TE/HdwkaGPnnQmA7XnusJNRLr1fNhRQGQ4A z8a/n8dWEhCC4iT/7VmQJsy0Gegi+xBwkb/kVRN4Mi9MNujwbT2yhAkYMDADzyx+qdB2 IJT8gfeZqCgPrxt5AfpKAU61y3sLeF/8SCZoSHeHkE2r7Ms5A9PeOIwK/nvRGl2i5EXJ zB3w== X-Gm-Message-State: AOJu0Yyg2OSUGEPZG78ef0HhT95W4PMzoPnjSY8JM6f96g3TA3I4Dfpn NEiH1G1Akq/MQpFIHA9MbtpPZtEYnkj5G9qB9mU= X-Google-Smtp-Source: AGHT+IHExOh3FK1/M1iZ8yLjKdXuwg2uKjTnET3Nb7Z2OM3f61hhk8SqkbNDwCZIF/Wk8Bi6BnQa9pGpDb39xbF6yQU= X-Received: by 2002:a2e:9ecd:0:b0:2ba:7fc2:cc4c with SMTP id h13-20020a2e9ecd000000b002ba7fc2cc4cmr8306459ljk.24.1694478161827; Mon, 11 Sep 2023 17:22:41 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 11 Sep 2023 17:22:41 -0700 In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Mon, 13 Mar 2023 15:47:38 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270118 Archived-At: Jo=C3=A3o T=C3=A1vora writes: > On Mon, Mar 13, 2023 at 7:22=E2=80=AFAM Pedro Andres Aranda Gutierrez > 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-ac= tions) > + "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=C3=A3o 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.