emacs-devel
[Top][All Lists]
Advanced

[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: Mon, 03 Nov 2014 09:46:28 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (windows-nt)

Stefan Monnier <address@hidden> writes:

>>> M-. RET  does "find the callers of a symbol at point", AFAICT.
>
> Duh, sorry for being dense, of course it doesn't.  etags does not offer
> the needed info, so the etags.el UI doesn't have such a thing.

In emacs -Q, M-. is 'find-tag', which prompts for a tag with the default
being the identifer at point, and goes to the first occurrence of that
identifier in the tags table. Then tags-loop-continue goes to the next
occurrence.

The occurrences will include the calling locations; perhaps that is what
was meant here.

In other situations, "find the callers" would mean go to the start or
declaration of the calling functions, not the point of the call.

ada-mode provides "show all references", which is the same as "show all
calls" for functions. It does not currently have "show all callers".

> So on the UI side we mostly have:
> - "jump to *the* definition of thing at point".
> - "list definitions of thing at point".

    These two should be combined; only show the list if it has more than
    one item. The point is that in most cases there is only one, so
    showing the list is just an annoyance.
    
> - "list uses of thing at point".

    This should show the list if there is only one; that's not typical,
    and is important information.
    
> - "return to buffer/position before the last jump".

I'm not clear this should be separate from the mark ring (push-mark,
pop-mark).

> And on the backend side we have:
> - identifier-at-point-function

    This probably does not need to be separate; the other functions will
    call the equivalent backend function.

> - find-definition-function (with an argument to decide whether we want
>   a whole list or just the best/first candidate).

    I don't think we need that argument. Instead, it could take an
    optional argument 'identifier', which would be used instead of
    indentifier-at-point.
    
> - find-uses-function

> Etags.el currently offers some additional functionality:
> - jump to definition of any identifier, with TAB-completion.

    This implies that the backend has to provide the list of identifiers
    for completion; that's a new backend function 'complete-identifier'.

    ada-mode doesn't have that now, but it could be useful.

    It could also get very slow; the list of identifiers can be very
    large. I guess that's no different from the current tags usage.
    
> - jump to file (among those listed in the TAGS file), tho currently
>   without TAB-completion.

    Another backend function; 'complete-file-name'.

    Or it could be 'project-directories' and 'project-extensions', to
    be used with ff-get-file.

    ada-mode uses compilation-search-path for 'project-directories', and
    ada-body-suffixes, ada-spec-suffixes for 'project-extensions.

    ada-mode does not currently provide jump to file with prompt, only
    jump to file derived from identifier at point. Prompt would be
    useful.
    
> And the second one is also provided by things like projectile (among
> many other thingies), tho it seems that none of the bundled Emacs
> packages provide a good solution for that common need.

I think ff-get-file is good. But maybe others want a more restricted list?

-- 
-- Stephe



reply via email to

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