From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 28 03:34:17 2023 Received: (at submit) by debbugs.gnu.org; 28 Aug 2023 07:34:17 +0000 Received: from localhost ([127.0.0.1]:46789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaWlN-0001Of-Et for submit@debbugs.gnu.org; Mon, 28 Aug 2023 03:34:17 -0400 Received: from lists.gnu.org ([2001:470:142::17]:48156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaWlL-0001OR-BY for submit@debbugs.gnu.org; Mon, 28 Aug 2023 03:34:16 -0400 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 1qaWl8-0006Eo-Jj for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2023 03:34:03 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qaWl4-0003ma-5n for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2023 03:34:01 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 2A5171C0005 for ; Mon, 28 Aug 2023 07:33:54 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: Eglot with mouse Organization: LINKOV.NET Date: Mon, 28 Aug 2023 10:13:58 +0300 Message-ID: <86zg2beibp.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-GND-Sasl: juri@linkov.net Received-SPF: pass client-ip=217.70.183.197; envelope-from=juri@linkov.net; helo=relay5-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) X-Debbugs-CC: Joćo Tįvora 0. emacs -Q 1. enable context-menu-mode 2. enable eglot in a suitable buffer 3. move point to one identifier 4. click the right mouse button on another identifier 5. in the context menu click "Find Definition" The problem is that a wrong identifier is visited. Whereas 'xref-find-definitions-at-mouse' takes care about getting the right identifier at the clicked position, Eglot returns a fictitious identifier "LSP identifier at point" that can't be used to find the identifier at the mouse click. xref-find-definitions-at-mouse uses save-excursion with mouse-set-point before calling xref-backend-identifier-at-point. But the same save-excursion with mouse-set-point can't be added around xref-find-definitions because save-excursion will restore the original position after visiting the found identifier. Also tried to add xref-find-definitions-at-mouse to the list xref-prompt-for-identifier, no effect. Then tried to remove '(xref--prompt-p this-command)' from 'xref-backend-identifier-at-point ((_backend (eql eglot)))'. This fixed xref-find-definitions-at-mouse, but still doesn't work for xref-find-references-at-mouse. Also removing '(xref--prompt-p this-command)' has such a strange effect that it started to find approximate fuzzy matches that sound like the original identifier. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 28 05:17:46 2023 Received: (at 65578) by debbugs.gnu.org; 28 Aug 2023 09:17:46 +0000 Received: from localhost ([127.0.0.1]:46985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaYNW-00048x-2O for submit@debbugs.gnu.org; Mon, 28 Aug 2023 05:17:46 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:44495) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaYNT-00048h-Rx for 65578@debbugs.gnu.org; Mon, 28 Aug 2023 05:17:44 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fee600dce6so27938175e9.1 for <65578@debbugs.gnu.org>; Mon, 28 Aug 2023 02:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693214250; x=1693819050; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CJlKhfMU64Rjy+kkHugSVpnoxvCYyplHAas7+SNOG6w=; b=DvJBCgiOLuXjBc/snD/ZZoPej+sPwO5DCgUgXf3W0ZjFHTqwMNZZj4gpCltomdWqPB 5c7fkYkgXRWsdvh9tOyDtgW7IBhsszYEwL+vGs7Ux2IxLMX1zwz+WtBIZ98eiwYv5Geq McooXgHgFnj5jZnuDQ8u6f0HKfa/VL+SWukaVFzntF52wVaCCSIrPsxVgx1Xj9+QjmrU qAn0Psrw1UftrU1qD7ES4LJ4OuQ1bysN3WNQt/uH/hd4wcly1hOS9VGzs5TXrAY5MRz0 5r3m7coZ7OTl6kAzXtgXg0KvoQYnOh7T8B6M5+zL/MfaoCe+skEA/LbnV9TkNS88TwCJ oe3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693214250; x=1693819050; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CJlKhfMU64Rjy+kkHugSVpnoxvCYyplHAas7+SNOG6w=; b=ch1y0PWRAnotEz6aIEsW5SvbQSn4m/RCpFzn2Hp/8YOOIHfK5IdsZscomit50ymXTz 2sTj30LAhzuUOrg7/vE/wSTnmusA7NWPrrrd1r5wYe0tnkmziCjwpuJV32eZB3NELJj5 ZyVCbiEo3tYbjqeNJkm0DW6xBLy+IPheU16BFiQttTIJjLEO+YlQ3fNA+RyIZniCm09+ eGfoLso5T1W/Kz6HXmsA11oACsunlhG2XvF++2XTLr6Skrtj+H7eaDrloyqzQ8lm5j/t XL1k+MEmftNt3ds4S1ZJbbHLHhnAzieWG1P5FaZzR0na6G6F4CpEh1NJnc+Vr+mO88D+ drVQ== X-Gm-Message-State: AOJu0YyPFSi2isMKIDGu1NMOPHQbARw3ayicrbouXuYCQ4Eegc5NM4qt inpfP0a9bSpahu4z3/Z1X9kEnLgR/rh+pg== X-Google-Smtp-Source: AGHT+IHSiOHd1VSLNyE5vSmQKNMFxA6JEGibkgngTEe+XX3NkIQosNo9tnRJ67FTUhQCh0Hdkvt9rw== X-Received: by 2002:a05:600c:ace:b0:401:4c61:90ac with SMTP id c14-20020a05600c0ace00b004014c6190acmr8864896wmr.11.1693214250388; Mon, 28 Aug 2023 02:17:30 -0700 (PDT) Received: from krug ([87.196.73.66]) by smtp.gmail.com with ESMTPSA id r9-20020adff709000000b0031ad5a54bedsm10081205wrp.9.2023.08.28.02.17.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 02:17:30 -0700 (PDT) From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= To: Juri Linkov Subject: Re: bug#65578: Eglot with mouse In-Reply-To: <86zg2beibp.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 28 Aug 2023 10:13:58 +0300") References: <86zg2beibp.fsf@mail.linkov.net> Date: Mon, 28 Aug 2023 10:20:12 +0100 Message-ID: <875y4zbk1f.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65578 Cc: dmitry@gutov.dev, 65578@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: > X-Debbugs-CC: Jo=C3=A3o T=C3=A1vora > > 0. emacs -Q > 1. enable context-menu-mode > 2. enable eglot in a suitable buffer > 3. move point to one identifier > 4. click the right mouse button on another identifier > 5. in the context menu click "Find Definition" > > The problem is that a wrong identifier is visited. > > Whereas 'xref-find-definitions-at-mouse' takes care > about getting the right identifier at the clicked position, > Eglot returns a fictitious identifier "LSP identifier at point" > that can't be used to find the identifier at the mouse click. I don't think the name Eglot gives to the identifier matters here. What matters is that the LSP request is made with the correct buffer position (where the user clicked). So if 'xref-find-definitions-at-mouse' already has logic to protect that, it should work. > xref-find-definitions-at-mouse uses save-excursion with > mouse-set-point before calling xref-backend-identifier-at-point. > But the same save-excursion with mouse-set-point can't be added > around xref-find-definitions because save-excursion will restore > the original position after visiting the found identifier. Alas, somehow, the position obtained when mouse is in the correct spot in the first step must be recorded somehow and survive until the second step. Else, with LSP, it just won't work, not in the near future at least. I'd say this is something to be changed in Xref. > Also tried to add xref-find-definitions-at-mouse to the list > xref-prompt-for-identifier, no effect. > > Then tried to remove '(xref--prompt-p this-command)' > from 'xref-backend-identifier-at-point ((_backend (eql eglot)))'. > This fixed xref-find-definitions-at-mouse, but still > doesn't work for xref-find-references-at-mouse. > Also removing '(xref--prompt-p this-command)' has such a strange effect > that it started to find approximate fuzzy matches that sound like > the original identifier. I don't think any of this is the solution. This is a more-or-less typical case where the workhorse function non-mouse function called by the mouse function does too much. An elegant (perhaps verbose) solution would separate the definition-requesting from the definition-visiting parts of the former, and then the mouse function would use the two parts separately. But in practice I think something like a variable shared set in the interactive spec and read in the function body. Or maybe a text property in the dummy "LSP Identifier at point" string. Let's see what Dmitry has to say. Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 28 09:41:30 2023 Received: (at 65578) by debbugs.gnu.org; 28 Aug 2023 13:41:30 +0000 Received: from localhost ([127.0.0.1]:47429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qacUk-0005c0-Er for submit@debbugs.gnu.org; Mon, 28 Aug 2023 09:41:30 -0400 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:55605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qacUi-0005bo-V4 for 65578@debbugs.gnu.org; Mon, 28 Aug 2023 09:41:29 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id E27893200754; Mon, 28 Aug 2023 09:41:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 28 Aug 2023 09:41:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1693230075; x=1693316475; bh=sk49lwGaXbJ6/fgNIzPytjYzg+uJ+S6Ocbl SS5MmQI4=; b=OcAw6O/oTn9Y6CmAEb1+LqqCk77Pag2TCUsAuh9ZOPSVs3aa+Gg iUAH8si/6sUxxtDly2RiIbUd1A5yQtj5Ot3eybiwKb2TNSxYHCiePnQ+2WrEKLqf x+lRyo6gbFwLPIx1Gt+VRYtdEw/0Ys/ZZOLRj6N4pekVxmXaFsJj7g8Jua1HALKW FjHPjgiBFqmbVP1oTnzYpv+JsNF/UW5gIyqaMToNgwvUfmmWRoJYcGY+w/FkDWti xtDUucvChlzNvWDhHVDd7xPBX9CVTTDeqPKo2MUv99ObN0xrQAtrS1k6Wkq4kvsG tKQLnkiIQzAAcDoZS4BaB5U8rYpBPCPifTg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1693230075; x=1693316475; bh=sk49lwGaXbJ6/fgNIzPytjYzg+uJ+S6Ocbl SS5MmQI4=; b=ixoCMicFaED5b6djX6LKyUwTD5IMfsNwlhLv6ORw38JM+TOeogV hmxredhF8mlsWFjK/qauu1X65rveCcifRhNc4h3kkIFcALAAECLinZva8V9YiUNL vKjaM28zZxcxDtnI/1TN7vw2OSOWfeyuO1f7A5hG6GsuXx4hw9o0tYIAlfPzyZYS 34XAzTEDrU54mVYGbI29/5L/NvELMlcZEjDXzmXioDogykyuK7H7zzCrcXF4RJ+C m1Kz6zOsAyaO28sX+R+qvBFedW28vPR2z1ZK/IYe7LUzUlkQqFKgjwAFMQeoJ6Pp T8g3v9jIlQsX+C07eZJLKBLbKKOMDmsI45w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefgedgieehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Aug 2023 09:41:14 -0400 (EDT) Message-ID: <402f3c93-748b-62d3-593f-4b852839deae@gutov.dev> Date: Mon, 28 Aug 2023 16:41:12 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: bug#65578: Eglot with mouse Content-Language: en-US To: Juri Linkov , 65578@debbugs.gnu.org References: <86zg2beibp.fsf@mail.linkov.net> From: Dmitry Gutov In-Reply-To: <86zg2beibp.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: 65578 Cc: =?UTF-8?B?am/vv71vIHTvv712b3Jh?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) On 28/08/2023 10:13, Juri Linkov wrote: > xref-find-definitions-at-mouse uses save-excursion with > mouse-set-point before calling xref-backend-identifier-at-point. > But the same save-excursion with mouse-set-point can't be added > around xref-find-definitions because save-excursion will restore > the original position after visiting the found identifier. Could we do that without additional save-excursion? diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 0666b18cba1..0c3e34fe0a5 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1637,7 +1637,9 @@ xref-find-definitions-at-mouse (mouse-set-point event) (xref-backend-identifier-at-point (xref-find-backend))))) (if identifier - (xref-find-definitions identifier) + (progn + (mouse-set-point event) + (xref-find-definitions identifier)) (user-error "No identifier here")))) ;;;###autoload From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 28 12:43:56 2023 Received: (at 65578) by debbugs.gnu.org; 28 Aug 2023 16:43:56 +0000 Received: from localhost ([127.0.0.1]:48903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qafLI-0002fM-1c for submit@debbugs.gnu.org; Mon, 28 Aug 2023 12:43:56 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:48807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qafLG-0002f5-71 for 65578@debbugs.gnu.org; Mon, 28 Aug 2023 12:43:55 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 5D7AEFF808; Mon, 28 Aug 2023 16:43:38 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#65578: Eglot with mouse In-Reply-To: <402f3c93-748b-62d3-593f-4b852839deae@gutov.dev> (Dmitry Gutov's message of "Mon, 28 Aug 2023 16:41:12 +0300") Organization: LINKOV.NET References: <86zg2beibp.fsf@mail.linkov.net> <402f3c93-748b-62d3-593f-4b852839deae@gutov.dev> Date: Mon, 28 Aug 2023 19:42:02 +0300 Message-ID: <86o7irce5h.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 65578 Cc: 65578@debbugs.gnu.org, =?iso-8859-1?Q?Jo=E3o_T=E1vora?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> xref-find-definitions-at-mouse uses save-excursion with >> mouse-set-point before calling xref-backend-identifier-at-point. >> But the same save-excursion with mouse-set-point can't be added >> around xref-find-definitions because save-excursion will restore >> the original position after visiting the found identifier. > > Could we do that without additional save-excursion? > > diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el > index 0666b18cba1..0c3e34fe0a5 100644 > --- a/lisp/progmodes/xref.el > +++ b/lisp/progmodes/xref.el > @@ -1637,7 +1637,9 @@ xref-find-definitions-at-mouse > (mouse-set-point event) > (xref-backend-identifier-at-point (xref-find-backend))))) > (if identifier > - (xref-find-definitions identifier) > + (progn > + (mouse-set-point event) > + (xref-find-definitions identifier)) > (user-error "No identifier here")))) The problem with this solution is that when it doesn't find the identifier then it leaves point at the wrong place. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 28 13:00:32 2023 Received: (at 65578) by debbugs.gnu.org; 28 Aug 2023 17:00:32 +0000 Received: from localhost ([127.0.0.1]:48946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qafbL-0003KZ-IH for submit@debbugs.gnu.org; Mon, 28 Aug 2023 13:00:31 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:35737) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qafbI-0003KG-9A for 65578@debbugs.gnu.org; Mon, 28 Aug 2023 13:00:29 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id C62E43200D56; Mon, 28 Aug 2023 13:00:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 28 Aug 2023 13:00:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1693242015; x=1693328415; bh=/8u5u/fC8mndy2SN8f3WhTqe7BkfxP2KmbM fUZDhrhg=; b=F/aCL7Hzwpmd5YHA+lmtGyDBYabLALHASQ/g5mLGMfIO2H1BW23 TXRNOiiU50FDm3mJ4DxTQVdycaK0pQQXhAmCWBl0hH2mM4TkcBJZ8dGwH6UPCsIg yweuiAl3tWoN1GYZvJVqmLHt3FNWYv6Fu5UpWb3f89cqUuzQmFOmEkPXxY6ROZsa rB/twMZkiB8O3BQUpJ0X4EoZLx9NzM1D/eRfLanECCvU12OaiT3cPrGaLlscRxod Cwr7SXK2nAu+BGVfy61bzsJPzwT7rB8l/mC68Poe2okNQ4YFwe4ufVGJMKljr3+9 Hx3tyTJ8yXeOs6qCwJGV4RYMsn6Dgm4Xcdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1693242015; x=1693328415; bh=/8u5u/fC8mndy2SN8f3WhTqe7BkfxP2KmbM fUZDhrhg=; b=GB0L9QGnPUbFfyfOEFKa22yRDPcBJb6cx2NB1oQNQLrqRQljkiA ereNwbfO7mUZ0LU+POEkFNxpru6pfZcZzR9lIfR3/gohl4xkjm2rO5doywpYZrgB vqqHZNiL3ZBm82/8hnyCNeo4+GKrisrkVxkt3jCwktlIOweFGmazONS6bQbkWilz IktG/83ATPse4YF9Cnevn33vqs/7B9o7HfozoTQ3YhbFCldysMmzETlEI7lmdT/0 XDpURVS+60qsbXVR6hwRZpp69dMlkKpQyB8KJwxr0ciW/J0NzZRwo4AjN1ajLQSh VlMVhttkESS7lEj+FQFoZvVPwWERFkka+Gw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefgedguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhm ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg htthgvrhhnpeeigfetveehveevffehledtueekieeikeeufeegudfgfeeghfdulefgfeev ledvveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Aug 2023 13:00:13 -0400 (EDT) Message-ID: <06ccb99d-27e5-179d-f34e-3ce64f92879d@gutov.dev> Date: Mon, 28 Aug 2023 20:00:12 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: bug#65578: Eglot with mouse Content-Language: en-US To: Juri Linkov References: <86zg2beibp.fsf@mail.linkov.net> <402f3c93-748b-62d3-593f-4b852839deae@gutov.dev> <86o7irce5h.fsf@mail.linkov.net> From: Dmitry Gutov In-Reply-To: <86o7irce5h.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: 65578 Cc: 65578@debbugs.gnu.org, =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) On 28/08/2023 19:42, Juri Linkov wrote: >>> xref-find-definitions-at-mouse uses save-excursion with >>> mouse-set-point before calling xref-backend-identifier-at-point. >>> But the same save-excursion with mouse-set-point can't be added >>> around xref-find-definitions because save-excursion will restore >>> the original position after visiting the found identifier. >> Could we do that without additional save-excursion? >> >> diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el >> index 0666b18cba1..0c3e34fe0a5 100644 >> --- a/lisp/progmodes/xref.el >> +++ b/lisp/progmodes/xref.el >> @@ -1637,7 +1637,9 @@ xref-find-definitions-at-mouse >> (mouse-set-point event) >> (xref-backend-identifier-at-point (xref-find-backend))))) >> (if identifier >> - (xref-find-definitions identifier) >> + (progn >> + (mouse-set-point event) >> + (xref-find-definitions identifier)) >> (user-error "No identifier here")))) > The problem with this solution is that when it doesn't find > the identifier then it leaves point at the wrong place. I'm not sure is a big problem, but we could save the original position and restore it in case of error too: diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 0666b18cba1..fb7380dee77 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1635,9 +1635,18 @@ xref-find-definitions-at-mouse (let ((identifier (save-excursion (mouse-set-point event) - (xref-backend-identifier-at-point (xref-find-backend))))) + (xref-backend-identifier-at-point (xref-find-backend)))) + (buf (current-buffer)) + (pos (point))) (if identifier - (xref-find-definitions identifier) + (condition-case err + (progn + (mouse-set-point event) + (xref-find-definitions identifier)) + (user-error + (set-buffer buf) + (goto-char pos) + (user-error (message (error-message-string err))))) (user-error "No identifier here")))) ;;;###autoload From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 28 13:08:58 2023 Received: (at 65578) by debbugs.gnu.org; 28 Aug 2023 17:08:58 +0000 Received: from localhost ([127.0.0.1]:48957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qafjW-0003YX-EW for submit@debbugs.gnu.org; Mon, 28 Aug 2023 13:08:58 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]:55509) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qafjU-0003YK-LS for 65578@debbugs.gnu.org; Mon, 28 Aug 2023 13:08:57 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b9338e4695so52435631fa.2 for <65578@debbugs.gnu.org>; Mon, 28 Aug 2023 10:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693242524; x=1693847324; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oiVj9TEgPp4+OaW/P2zgfGkrD276tTME8HdCZsATjtk=; b=OCIpaUJBjEcJ6yeUrl+8260GTtf4EGbSABTDbmcOEVHt7QITrn5VNdblV5SepuaS9l pjHcKx3wgyux+KMPSCxecOCw+P39p5MP7jIIlEaFYqwAhRTWF3GY1oJc60L4FBGrkRmk SZEgPji2xVBdUQA3zqK440TfA9BSPbLauRSt6ar1V32WAIARVi0DVRK55ysVoKDDGHEp lIoYLPV+BJC28KYnWZ00c+Iqh2TMz6x5G2Mk2G6+LNS1lHTtDgKoAkhGdI6W0AHO9GgA oU1rtI2wWAhhx0dHP91/9ANMjhG/UYpfmR9Kt/m6tagbLMBQNhSFgL3JlfkjM9/w5BxH rvCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693242524; x=1693847324; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oiVj9TEgPp4+OaW/P2zgfGkrD276tTME8HdCZsATjtk=; b=IaK8cPibQq2MTonGCwHp1tEOwARGN6wSaus+XPkMqNoE6bBw7WkpCqC8mF0kkca5N1 4pKmGVJBxZ0C053M/mL2jNTdJucBXXJ7rd4WtQc+RKKMCo/VstfIuXE1Qdr7VPzOvmWH L0axMB3ugERxLe7V0XNyy8qOU3uz0a9eZa87xvwwKi7ezn4anPZ5wpI3Z6y3EVqRtfW4 8eKgU7nVyltm8P3n3CprSfjqxkLvSObCSJgKOTOHDJ/TX7qb4y8TXWMG4nQm0/rptgoh TsNOK40+WfqXB/m14Cpw5s4FMObq6ICvToXT6CfTe4uA7Na1tBNV1o0+n8y1c7HK9dYh CbCQ== X-Gm-Message-State: AOJu0Yx7cxJ2D3OYZ0vyOPwwM6uGao4q5Fb43Cobz2guL7CT/KzjnRA2 HydR18cXI7z00rRqTpepB5mdt/SeWbWE+zvHqoyZ0rMzIq4= X-Google-Smtp-Source: AGHT+IGh7btWh3iTgekTpRIu8+icaAqs9yMz+1yydq3MEpVEJbungfg4HnBD8N+ijP7+k5ElvTFZQ+F7PW6Pth/HEC8= X-Received: by 2002:a2e:8891:0:b0:2b9:f3b4:6808 with SMTP id k17-20020a2e8891000000b002b9f3b46808mr20466989lji.29.1693242523898; Mon, 28 Aug 2023 10:08:43 -0700 (PDT) MIME-Version: 1.0 References: <86zg2beibp.fsf@mail.linkov.net> <402f3c93-748b-62d3-593f-4b852839deae@gutov.dev> <86o7irce5h.fsf@mail.linkov.net> <06ccb99d-27e5-179d-f34e-3ce64f92879d@gutov.dev> In-Reply-To: <06ccb99d-27e5-179d-f34e-3ce64f92879d@gutov.dev> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Mon, 28 Aug 2023 18:11:14 +0100 Message-ID: Subject: Re: bug#65578: Eglot with mouse To: Dmitry Gutov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65578 Cc: 65578@debbugs.gnu.org, Juri Linkov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Mon, Aug 28, 2023 at 6:00=E2=80=AFPM Dmitry Gutov wro= te: > > On 28/08/2023 19:42, Juri Linkov wrote: > >>> xref-find-definitions-at-mouse uses save-excursion with > >>> mouse-set-point before calling xref-backend-identifier-at-point. > >>> But the same save-excursion with mouse-set-point can't be added > >>> around xref-find-definitions because save-excursion will restore > >>> the original position after visiting the found identifier. > >> Could we do that without additional save-excursion? > >> > >> diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el > >> index 0666b18cba1..0c3e34fe0a5 100644 > >> --- a/lisp/progmodes/xref.el > >> +++ b/lisp/progmodes/xref.el > >> @@ -1637,7 +1637,9 @@ xref-find-definitions-at-mouse > >> (mouse-set-point event) > >> (xref-backend-identifier-at-point (xref-find-backend))))) > >> (if identifier > >> - (xref-find-definitions identifier) > >> + (progn > >> + (mouse-set-point event) > >> + (xref-find-definitions identifier)) > >> (user-error "No identifier here")))) > > The problem with this solution is that when it doesn't find > > the identifier then it leaves point at the wrong place. > > I'm not sure is a big problem, but we could save the original position > and restore it in case of error too: Have to agree with Dmitry. If I click a position to get a xref to somewhere else, I'm kind of already expecting/hoping that point moves. So the fact that, in the error/exception case, it sticks to the place where I right-clicked is really not so bad. Personally, I'd not complicate the implementation beyond what Dmitry proposed initially. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 30 12:40:59 2023 Received: (at 65578) by debbugs.gnu.org; 30 Aug 2023 16:41:00 +0000 Received: from localhost ([127.0.0.1]:53857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbOFX-0007V3-LH for submit@debbugs.gnu.org; Wed, 30 Aug 2023 12:40:59 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:43917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbOFN-0007UV-Vg for 65578@debbugs.gnu.org; Wed, 30 Aug 2023 12:40:50 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 3C6FDE0005; Wed, 30 Aug 2023 16:40:33 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#65578: Eglot with mouse In-Reply-To: <06ccb99d-27e5-179d-f34e-3ce64f92879d@gutov.dev> (Dmitry Gutov's message of "Mon, 28 Aug 2023 20:00:12 +0300") Organization: LINKOV.NET References: <86zg2beibp.fsf@mail.linkov.net> <402f3c93-748b-62d3-593f-4b852839deae@gutov.dev> <86o7irce5h.fsf@mail.linkov.net> <06ccb99d-27e5-179d-f34e-3ce64f92879d@gutov.dev> Date: Wed, 30 Aug 2023 19:35:45 +0300 Message-ID: <86h6og4k6m.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 65578 Cc: 65578@debbugs.gnu.org, =?iso-8859-1?Q?Jo=E3o_T=E1vora?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>> @@ -1637,7 +1637,9 @@ xref-find-definitions-at-mouse >>> - (xref-find-definitions identifier) >>> + (progn >>> + (mouse-set-point event) >>> + (xref-find-definitions identifier)) >>> (user-error "No identifier here")))) >> The problem with this solution is that when it doesn't find >> the identifier then it leaves point at the wrong place. > > I'm not sure is a big problem, but we could save the original position and > restore it in case of error too: Thanks. I tend to agree with Joćo that your initial version would be sufficient to leave point at the position of right-clicking. Then the same change is also needed in xref-find-references-at-mouse with mouse-set-point before xref-find-references. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 30 20:27:49 2023 Received: (at 65578-done) by debbugs.gnu.org; 31 Aug 2023 00:27:49 +0000 Received: from localhost ([127.0.0.1]:54307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbVXJ-0002Zx-71 for submit@debbugs.gnu.org; Wed, 30 Aug 2023 20:27:49 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:51401) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbVXF-0002Zi-N9 for 65578-done@debbugs.gnu.org; Wed, 30 Aug 2023 20:27:47 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 45DF35C009B; Wed, 30 Aug 2023 20:27:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 30 Aug 2023 20:27:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1693441652; x=1693528052; bh=XAgRRWKdCHcDzNJhY/wOw9BfgH5UKixE+9S KrA4A5PI=; b=jqdy0C9En555P6n/kQClHYPon9Rk0kVhGeUG67iT4lecJDNZj0v y+zGEabOOGwABlJKSe0tZdNiFZWF4T0PEW98ZEd1iS9z6wCqzJZ7W1vKlEEFE+O+ TmtImVWkcZsEN8nA9MreYGE8wzMSiLNno5e2ilQdcM5PQRvODhNXD4kauN1DtoXt ooNQk6cKOvw0SiHx2Dty9vcQ3aiLecojXYXdhtgEQeWgzgqQ2jYD3XeHiZAZBJVY Uvqf9MlG3hoEC4Uy7Azo+/bDddNLlu7gmrCyQp6nnuF2UYG4N4Go6KtGj+6bGPxU 4tOA2GVRArBL3PcezcWsCMTPoaTlsi3Wpww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1693441652; x=1693528052; bh=XAgRRWKdCHcDzNJhY/wOw9BfgH5UKixE+9S KrA4A5PI=; b=QYHrC7Ye4LP1ocyxjbdKyZDia2I6+xe/5Xe+3tEk+FbsBOE4Exf jsE3VK2gLVlwn3t2v0Gl8JIzlstcLnWqeWh3d9lRhfNDx4g2nGaRANUyKrtjJgDq aNdAM8rKTpdY98JHf/IInt6HSQUFeS062Z18ouFWsG2JSRJPlY4A3JOZAt9XnEA1 rZfRjYuQOT2okT/UjAWj8cY3gKfIZXXws9WpAgew2ruGH3GVMnpXIsaFnsXygr2M fQ/nBo/ZAW+YUjjoHOepEOYpWN27QafQLQaCSLqV+dHEaGUmPLdIS+C7tXIYbqwT 347IzROZENFyUY68WKsD+BZZreeBWD/PRuw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefledgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhephfffheeljeffgeffueeghfekkedtfffgheejvdegjeettdduheeufffggfef jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Aug 2023 20:27:31 -0400 (EDT) Message-ID: <6752a462-ac85-65b5-e960-023215a3ca6a@gutov.dev> Date: Thu, 31 Aug 2023 03:27:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: bug#65578: Eglot with mouse Content-Language: en-US To: Juri Linkov References: <86zg2beibp.fsf@mail.linkov.net> <402f3c93-748b-62d3-593f-4b852839deae@gutov.dev> <86o7irce5h.fsf@mail.linkov.net> <06ccb99d-27e5-179d-f34e-3ce64f92879d@gutov.dev> <86h6og4k6m.fsf@mail.linkov.net> From: Dmitry Gutov In-Reply-To: <86h6og4k6m.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: 65578-done Cc: 65578-done@debbugs.gnu.org, =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) Version: 30.1 On 30/08/2023 19:35, Juri Linkov wrote: >>>> @@ -1637,7 +1637,9 @@ xref-find-definitions-at-mouse >>>> - (xref-find-definitions identifier) >>>> + (progn >>>> + (mouse-set-point event) >>>> + (xref-find-definitions identifier)) >>>> (user-error "No identifier here")))) >>> The problem with this solution is that when it doesn't find >>> the identifier then it leaves point at the wrong place. >> I'm not sure is a big problem, but we could save the original position and >> restore it in case of error too: > Thanks. I tend to agree with JoĆ£o that your initial version would be > sufficient to leave point at the position of right-clicking. > > Then the same change is also needed in xref-find-references-at-mouse > with mouse-set-point before xref-find-references. Very good, if you don't mind the side-effect too, I've pushed the fix for both functions to master. And closing. BTW, this context-menu-mode is looking pretty nifty. It'd be nice to turn it on by default someday. From unknown Sat Aug 16 12:43:53 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 28 Sep 2023 11:24:17 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator