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

From: Dmitry Gutov <[email-masked]>
Date: Wed, 21 Jan 2015 16:24:33 +0200

On 01/21/2015 12:49 PM, martin rudalics wrote:

> The idea to do it via the KILL argument is good.  I think some
> doc-strings are bad.  For example, instead of
>
> (defvar-local xref--selected nil
>    "t if the current buffer has ever been selected.
> Used for temporary buffers.")
>
> I'd say something like
>
> (defvar-local xref--current nil
>    "Non-nil if this buffer was current once while finding xrefs.")

"current" would be good, but "while finding xrefs" is iffy: we actually 
try to ignore instances of buffers being current while we display them 
(see xref--inhibit-mark-selected).

> And for `xref-quit' I'd describe the standard behavior first and the
> KILL behavior afterwards.

Would you like to suggest a specific wording?

> Also I'm not sure it it's just cosmetics but
> shouldn't the
>
>      (pcase-dolist (`(,buf . ,win) history)
>        (when (and (window-live-p win)
>                   (eq buf (window-buffer win)))
>          (quit-window nil win)))
>
> precede the
>
>      (when kill
>        (let ((xref--inhibit-mark-selected t)
>              kill-buffer-query-functions)
>          (dolist (buf xref--temporary-buffers)
>            (unless (buffer-local-value 'xref--selected buf)
>              (kill-buffer buf)))
>          (setq xref--temporary-buffers nil)))
>
> part?

Probably, but there's likely not much difference at the moment. xref 
doesn't pop any new windows, so we shouldn't miss on deleting those when 
quitting temporary buffers.

> I can't test it currently because I always get
>
> Debugger entered--Lisp error: (args-out-of-range "" 0)
>    help-function-arglist(#[257 "\300\207" ["(No location)"] 2 "(No
> location)\n\n(fn ##)"] preserve-names)
>    eieio--defmethod(xref-location-group nil xref-bogus-location #[257
> "\300\207" ["(No location)"] 2 "(No location)\n\n(fn ##)"])

I'm sure Someone(tm) will fix that right away. :)

>  > xref-goto-xref calls xref-quit without the KILL argument, so the
> temporary buffers are not cleared if you make a choice and press RET.
>
> You can redisplay the *xref* buffer and provide the KILL there.

You mean, for the user to switch to the buried xref buffer, then press 
C-u q? That's quite a few keypresses.

>  >> previous-/next-history-element
>  >
>  > Not sure what these are.
>
> Something like typing M-. doing something else and typing M-. again.  At
> this time up/down should get you the next/previous history elements of
> your xref searches.

You mean in the current interface? I'm confused.

>  > debugger-mode should probably set both relevant vars to the same
> values as emacs-lisp-mode. help-mode and Custom-mode - maybe too,
> although they might use some custom logic.
>  >
>  > In Info-mode, xref-find-function could use the index and the search
> functionality.
>
> Will there be a canonical way to add these?

I meant that xref-identifier-completion-table-function would return 
identifiers from the index, and xref-find-function would delegate to the 
search functionality.

With xref, we already sorta have both as features (C-u M-x 
xref-find-definitions and M-x xref-find-apropos).