From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#65578: Eglot with mouse Date: Mon, 28 Aug 2023 18:11:14 +0100 Message-ID: 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> 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="26831"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65578@debbugs.gnu.org, Juri Linkov To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 28 19:09:07 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 1qafje-0006nO-Tp for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Aug 2023 19:09:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qafjW-0004AJ-W9; Mon, 28 Aug 2023 13:08:59 -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 1qafjU-00049w-Ru for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2023 13:08:56 -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 1qafjU-0004fp-2b for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2023 13:08:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qafja-0003Yo-4J for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2023 13:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Aug 2023 17:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65578 X-GNU-PR-Package: emacs Original-Received: via spool by 65578-submit@debbugs.gnu.org id=B65578.169324253813677 (code B ref 65578); Mon, 28 Aug 2023 17:09:02 +0000 Original-Received: (at 65578) by debbugs.gnu.org; 28 Aug 2023 17:08:58 +0000 Original-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 Original-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 Original-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) In-Reply-To: <06ccb99d-27e5-179d-f34e-3ce64f92879d@gutov.dev> 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:268645 Archived-At: 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.