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

From: martin rudalics <[email-masked]>
Date: Wed, 21 Jan 2015 17:54:07 +0100

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

In any case please stick to the "`current' is a predicate for buffers
and `selected' is a predicate for windows and frames" convention.

 >> And for `xref-quit' I'd describe the standard behavior first and the
 >> KILL behavior afterwards.
 >
 > Would you like to suggest a specific wording?

I'll try to as soon as I know what it does.  Usually the "If optional
argument KILL is non-nil ..." idiom should appear after describing the
normal behavior.

 >> 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,

... well, it did so here all the time ...

 > so we shouldn't miss on deleting those when quitting temporary buffers.

Are you sure?  Suppose `xref-show-location-at-point' reused a window
showing a buffer A for showing a buffer B instead.  Now `xref-quit'
would kill B which should again show A instead.  But here you rely on
`kill-buffer' (that is `replace-buffer-in-windows') DTRT.

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

For some value of "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.

Then you probably want the KILL argument for `xref-goto-xref' too.

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

When xref prompts me with

Find definitions of:

I'd expect to be able to browse my history of definitions I tried or
succeeded to find.

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

OK.  They all work well in my gdb buffer.  So it shouldn't be too hard.

martin