all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: 65578@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
Subject: bug#65578: Eglot with mouse
Date: Mon, 28 Aug 2023 18:11:14 +0100	[thread overview]
Message-ID: <CALDnm50vpexXCpJLEnLoMUrETSEegp7-uRPWxZCj=x9rzeapUA@mail.gmail.com> (raw)
In-Reply-To: <06ccb99d-27e5-179d-f34e-3ce64f92879d@gutov.dev>

On Mon, Aug 28, 2023 at 6:00 PM Dmitry Gutov <dmitry@gutov.dev> wrote:
>
> 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.





  reply	other threads:[~2023-08-28 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28  7:13 bug#65578: Eglot with mouse Juri Linkov
2023-08-28  9:20 ` João Távora
2023-08-28 13:41 ` Dmitry Gutov
2023-08-28 16:42   ` Juri Linkov
2023-08-28 17:00     ` Dmitry Gutov
2023-08-28 17:11       ` João Távora [this message]
2023-08-30 16:35       ` Juri Linkov
2023-08-31  0:27         ` Dmitry Gutov

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALDnm50vpexXCpJLEnLoMUrETSEegp7-uRPWxZCj=x9rzeapUA@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=65578@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=juri@linkov.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.