[Top][All Lists]

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

Re: Bad moves with xref-find-definitions

From: Stefan Monnier
Subject: Re: Bad moves with xref-find-definitions
Date: Sat, 25 Apr 2015 23:34:36 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> 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"?  We could make it signal an error, indeed.

> 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.

> Such changes should be broadly discussed. Somewhat surprisingly the
> thread that started the generalization [1] hasn't touched the issues
> that I have raised.

We did discuss those UI issues.  You're not the first to bring it up.
I personally don't think it's such a major change.

> As to my 2nd original point. I think the exclusive approach of tags *or*
> dynamic completion is not the correct one.  There should be a way to
> merge tag candidates with dynamic candidates.

In theory at least there is (as Dmitry points out) by having the major
modes change the variable via `add-function' using :around or something
like that.  I haven't tried doing so, so I don't know if it turns out to
be easy to do that.  If it's not, then I'd welcome a patch that makes
it easier.
But if you want to override the major mode to use etags, you probably
want to use xref-etags-mode.

> 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).


reply via email to

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