all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: "João Távora" <joaotavora@gmail.com>, 32034@debbugs.gnu.org
Subject: bug#32034: 26.1; [PACTH] better xref-location-marker for imperfect file locations
Date: Tue, 3 Jul 2018 16:56:42 +0300	[thread overview]
Message-ID: <5ab17038-c13d-3dde-2db9-4bc9a1042235@yandex.ru> (raw)
In-Reply-To: <87y3etsqb7.fsf@gmail.com>

Hi guys,

I've read up on the discussion.

On 7/2/18 4:46 PM, João Távora wrote:

> 1. xref-location-marker should check for `file-readable-p' before trying
> to open the file, and if that fails issues an error ("File %s can't be
> found.").

I'm fine with this, naturally.

> 2. if the file is found, xref-location-marker should detect if the
> location is indeed available in the file, and if it isn't, issue a
> message.  In that case it should return a marker to the nearest possible
> location.

When xref-location-marker is inaccurate, it may lead to problems, like 
xref-query-replace-in-results sometimes performing replacements at the 
"auto-corrected", wrong positions.

Maybe we can add a laxer version of this function that is only used when 
we know the user will be looking at the result directly (e.g. from 
xref-find-definitions, but not from xref-query-replace-in-results). I'm 
on the fence about xref-fined-references regarding this, because it also 
supports automatic replacement.

> 3. Number 2. could turn out to be brittle and annoying if we have
> changed the file in the meantime (but probably not more so than jumping
> to a wrong location).  So we could have a "hint" field in
> xref-file-location (or a xref-hinted-file-location) that helps in
> looking around the landing point for, say, a regexp, and puts point
> there.  Historically, this technique is successfully used in SLIME.  We
> could also reasonably default that field to the identifier being looked
> for.

I'm not sure this is a good idea. Certainly not the "defaulting to the 
identifier" bit. Because the identifier could e.g. look like 
namespace-name/symbol-name, where only "symbol-name" appears verbatim in 
the definition. I don't have much experience with LSP, but I imagine 
this could happen there, too (unless it only supports navigation to 
unqualified identifiers).

Now, if hint is optional (and disabled by default), and extracting the 
relevant code from Etags is natural, I say go for it.

But overall, I think individual backends that want "smarter" behavior 
should create their own "location" class, like Elisp does.





  parent reply	other threads:[~2018-07-03 13:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-02 13:46 bug#32034: 26.1; [PACTH] better xref-location-marker for imperfect file locations João Távora
2018-07-02 14:35 ` Robert Pluim
2018-07-02 15:22   ` João Távora
2018-07-02 14:47 ` Eli Zaretskii
2018-07-02 15:28   ` João Távora
2018-07-02 15:37     ` Eli Zaretskii
2018-07-02 15:50       ` João Távora
2018-07-02 16:32         ` Eli Zaretskii
2018-07-02 16:55           ` João Távora
2018-07-02 17:29             ` Eli Zaretskii
2020-08-10 12:59               ` Lars Ingebrigtsen
2020-08-10 18:53                 ` Dmitry Gutov
2020-08-10 20:42                   ` João Távora
2018-07-03 13:56 ` Dmitry Gutov [this message]
2018-07-03 14:50   ` João Távora
2018-07-03 15:07     ` Dmitry Gutov
2018-07-03 15:43       ` João Távora
2018-07-04 12:58         ` Dmitry Gutov
2018-07-04 13:37           ` João Távora
2018-07-04 14:33             ` Dmitry Gutov
2018-07-04 14:53               ` João Távora
2018-07-04 15:08                 ` Dmitry Gutov
2018-07-04 19:16                   ` João Távora

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=5ab17038-c13d-3dde-2db9-4bc9a1042235@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=32034@debbugs.gnu.org \
    --cc=joaotavora@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 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.