[Top][All Lists]

[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):


    aka find-definition-function

    aka find-uses-function

    If identifier-at-point is a type, show the definition of the types
    it inherits from.

    If identifier-at-point is a function, show definitions
    of functions that override it.

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


ada-mode would provide a tree as well.

-- Stephe

reply via email to

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