Subject: Re: bug#19466: 25.0.50; xref-find-def doesn't find C functions

From: Eli Zaretskii <[email-masked]>
Date: Thu, 22 Jan 2015 20:02:16 +0200

> Date: Thu, 22 Jan 2015 04:43:47 +0200
> From: Dmitry Gutov <[email-masked]>
> CC: [email-masked], [email-masked], [email-masked]
> 
> On 01/21/2015 06:25 PM, Eli Zaretskii wrote:
> 
> > Can the package that uses xref modify that string?  If so, we don't
> > need a single-fits-all phrase.
> 
> It can't, right now. But it would have to be modified by the used 
> command (find-definitions/references/apropos), not the package.
> 
> > If we do need a single phrase, then how about "go to
> > definition/reference"?
> 
> I've settled on "follow reference" for now.

Probably good enough, thanks.

> AFAICS you've pretty much stopped formulating the requirements at "there 
> should be a way to use the tags.el backend instead of the major mode's 
> backend".

Not really, I think that was Stefan's proposal.

What I need is a way to find definitions of both C and Lisp symbols
(functions, macros, struct's, etc.) irrespective of the current
buffer's major mode.  If xref can do that, it's fine with me.

> > If you can show me the complete Lisp, I can try that and return
> > feedback.
> 
> That would be good, but unless you declare one of them good enough, 
> participation in the technical discussion will also be needed.
> 
> >> Messages 32 and 41 include functional implementations you can try. The
> >> patches that would go into Emacs won't be much different, we'd just have
> >> to decide on code organization.
> >
> > The recipe in #32 is clearly incomplete.  Not sure about 41.
> 
> It's only incomplete because I expected you'd be able to turn on the 
> minor mode defined there yourself, in any Emacs Lisp buffers you like.
> 
> Here's the "missing piece" for #32:
> 
> (defun elisp-maybe-turn-on-xref-etags-mode ()
>    (when (and buffer-file-name
>               (string-prefix-p source-directory buffer-file-name))
>      (xref-etags-mode)))
> 
> (add-hook 'emacs-lisp-mode-hook 'elisp-maybe-turn-on-xref-etags-mode)
> 
> Which part of it was hard?
> 
> > Once again, if you can show a complete Lisp to try, I will.
> 
> To my knowledge, #41 was/is quite complete.

I will try those when I have time, thanks.