emacs-devel
[Top][All Lists]
Advanced

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

Re: force initialization of a datatype?


From: Stephen Leake
Subject: Re: force initialization of a datatype?
Date: Sat, 07 Nov 2015 12:30:13 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

Dmitry Gutov <address@hidden> writes:

> On 11/07/2015 09:05 AM, Stephen Leake wrote:
>
>> I don't follow.
>>
>> `elisp-xref-find-def-functions' is a hook that is called from
>> `elisp--xref-find-definitions'; why should it be in find-func?
>
> It would have a different name, of course, and maybe used indirectly
> through calling some of the find-func functions. But like you
> mentioned, we already have find-function-regexp-alist.
>
>> The only file that currently puts a function on that hook is
>> cedet/mode-local.el; it adds similar functionality to
>> `help-fns-describe-function-functions' and `find-function-regexp-alist'.
>
> Why can't we reuse the contents of those variables?

`help-fns-describe-function-functions' is intended to be called from
'describe-function'; it puts the results in a buffer.
`elisp-xref-find-def-functions' puts the results in a list of xrefs. So
the code is different.

`find-function-regexp-alist' is used by `find-function-search-for-symbol',
which in turn is used by `xref-location-marker ((l
xref-elisp-location))'. So we are reusing that variable.

> I think the meat of the code that knows how to find Elisp entities
> should be in one place.

The code that _finds_ elisp entities is
`find-function-search-for-symbol'; that is shared.

The rest of the code is for display. There may be some minor refactoring
opportunities, but the main differences between
`help-fns-describe-function-functions' and
`elisp-xref-find-def-functions' is that one outputs to a buffer, and the
other to a list of xrefs.

>> That code has a FIXME about moving it to
>> `elisp-xref-find-def-functions'; there is already code in cl-generic
>> that puts similar functionality on
>> `help-fns-describe-function-functions' and `find-function-regexp-alist'.
>
> What if some new third-party facility adds a relevant element to
> elisp-xref-find-def-funtcions, but not find-function-regexp-alist? Or
> vice versa?

Not all entries on `elisp-xref-find-def-functions' have a corresponding
entry in `find-function-regexp-alist'; they are not equivalent.

I think you meant `elisp-xref-find-def-functions' vs
`help-fns-describe-function-functions'; whatever xref can display,
describe-function should display, and vice versa.

A difference between the list of things xref can display and those that
describe-function can display is a bug (that includes more than just
those two lists).

There were a lot of such bugs when xref was introduced.

I've fixed some of them with `elisp-xref-find-def-functions', others
with other code in elisp--xref-find-definitions. There are still
a few remaining; see the FIXMEs in elisp-mode.el.

You seem to be suggesting that there should be a way to write one
function for both lists; that's certainly not possible.

We might be able to switch to a dispatching "display-function", with
one backend for help buffers and one for xrefs. But that does not change
the essential point that different code needs to be written for both.

-- 
-- Stephe



reply via email to

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