emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bad moves with xref-find-definitions


From: Vitalie Spinu
Subject: Re: Bad moves with xref-find-definitions
Date: Sun, 26 Apr 2015 13:31:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

 >>> Stefan Monnier on Sat, 25 Apr 2015 23:34:36 -0400 wrote:

 >> That's a bit besides the point. I want my interface to behave exactly
 >> the same independently of the context at point.

 > You're talking here about the fact that M-. will prompt if there's no
 > "thing at point"?  

Yes.

 > We could make it signal an error, indeed.

I would like that. At least it would force people using C-u. Now I
always navigate to empty space, even though I ware that it's a
completely stupid habit.

>> And, most importantly, I don't want to foster bad habits because my
 >> brain always chooses the easy path - navigate to a symbol instead of
 >> C-u.

 > Thing is: the two are different.  In some languages, figuring out "the
 > thing at point" may itself not be obvious and even finding
 > a human-palatable textual representation of "the thing at point" may
 > turn out to be extra work.

 > So M-. really means "pass the current buffer position to the backend and
 > let it figure out what are the possible corresponding definitions".
 > Whereas C-u M-. asks the user for a textual representation of some
 > definition, and then tries to find matching definitions.

 > Of course, we could make the "empty minibuffer" mean "use the current
 > buffer position", but it seems cleaner to short-circuit the minibuffer
 > so we don't have to use a special string for it.

Backend has to figure out the "thing" anyways. From there building
"textual representation" and passing back to xref is a triviality. Also,
you have to provide completions and textual representation of on C-u
anyways.

What do you currently do if there are multiple matching definitions of
the "thing-at-point"? Prompt?

 >> Having C/C++ api interface to higher order languages is a commonality
 >> rather than an exception nowadays.

 > I do not understand what you're trying to say here (more specifically,
 > I can't see how this relates to the discussion).

All I was trying to say is that tags are commonly useful alongside
dynamic backends. Blindly replacing tags with an even very good backend
is not the right direction IMW. Expecting from end users to solve this
problem with add-function :before is unacceptable if there are way to
fix it at Emacs level. 

Different backends can figure different "things-at-point". It would be
wise to try back-ends in turn, just like completion-at-point-functions
does.

As to prompting, if you try to accommodate multiple backends, then
merging completion candidates from multiple backends is a simple task
when you prompt. If you try instead to "bypass the minibuffer" it's
likely to be a much more difficult task.


  Vitalie



reply via email to

[Prev in Thread] Current Thread [Next in Thread]