[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generalizing find-definition
From: |
Stephen Leake |
Subject: |
Re: Generalizing find-definition |
Date: |
Tue, 04 Nov 2014 08:52:46 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (windows-nt) |
Stefan Monnier <address@hidden> writes:
> > from foo import Foo
> > bar = Foo()
> > bar.baz_|_
>> The only single string that reliably would allow to find the correct
>> definition would be "foo.Foo.baz", but I do not think that anyone
>> would consider that to be "the identifier at point" here.
>
> I would.
I would also, but I would not expect a generic Emacs function to return
that. It certainly requires a backend function.
I'm still not clear what 'identifier-at-point' is good for outside "goto
definition", "show uses", and completion. Since the meaning is highly
backend specific, I don't see what other parts of Emacs might use it.
You say there are other uses - can you list some?
In ada-mode, 'ada-identifier-at-point' is used in (ada-mode doesn't
provide completion yet):
ada-goto-declaration
aka find-definition-function
ada-show-references
aka find-uses-function
ada-show-declaration-parents
If identifier-at-point is a type, show the definition of the types
it inherits from.
ada-show-overriding
If identifier-at-point is a function, show definitions
of functions that override it.
ada-show-overridden
If identifier-at-point is a function, show definitions
of the function that it overrides.
The last three are additional candidates for the API.
>>> Note that such completion tables are clearly not lists of strings, but
>>> they're functions (actually, they're objects represented as functions,
>>> for lack of an object system).
>> What is the advantage of having the backend define a function that
>> returns a completion table as opposed to a function that prompts the
>> user for a symbol? The saved code seems minimal, and it means the
>> backend can not set the prompt, for example.
>
> It means the UI can use it for various kinds of completion (e.g. for
> completion-at-point-function).
+1
ada-mode would provide a tree as well.
--
-- Stephe
- Re: Generalizing find-definition, (continued)
- Re: Generalizing find-definition, Jorgen Schaefer, 2014/11/02
- Re: Generalizing find-definition, Stefan Monnier, 2014/11/02
- Re: Generalizing find-definition, Helmut Eller, 2014/11/03
- Re: Generalizing find-definition, Jorgen Schaefer, 2014/11/03
- Re: Generalizing find-definition, Stephen Leake, 2014/11/03
- Re: Generalizing find-definition, Stefan Monnier, 2014/11/03
- Re: Generalizing find-definition, Jorgen Schaefer, 2014/11/03
- Re: Generalizing find-definition, Stefan Monnier, 2014/11/03
- Re: Generalizing find-definition, Jorgen Schaefer, 2014/11/03
- Re: Generalizing find-definition, Stefan Monnier, 2014/11/03
- Re: Generalizing find-definition,
Stephen Leake <=
- Re: Generalizing find-definition, Stefan Monnier, 2014/11/04
- Re: Generalizing find-definition, Stephen Leake, 2014/11/04
- Re: Generalizing find-definition, Stefan Monnier, 2014/11/04
- Re: Generalizing find-definition, Dmitry Gutov, 2014/11/06
- Re: Generalizing find-definition, Stephen Leake, 2014/11/06
- Re: Generalizing find-definition, Yuri Khan, 2014/11/06
- Re: Generalizing find-definition, Dmitry Gutov, 2014/11/07
- Re: Generalizing find-definition, Stefan Monnier, 2014/11/03
- Re: Generalizing find-definition, Stephen Leake, 2014/11/04
- Re: Generalizing find-definition, Stephen J. Turnbull, 2014/11/03