Subject: bug#35702: xref revert-buffer

From: Dmitry Gutov <[email-masked]>
Date: Mon, 27 May 2019 17:54:21 +0300

On 26.05.2019 19:44, Eli Zaretskii wrote:

>> It's akin to asking what values could revert-buffer-function have:
>> different ones.
> 
> Although in theory there could indeed be an infinite number of values,
> in practice the current actual set is very small, and can be easily
> described.

And yet, it's not hugely important to the code that's calling it. Or for 
understanding of said code (call the function, show the returned items; 
call it again if the user wants to refresh the list). All that as long 
as the function adheres to its protocol. It's like 'cons' in that 
regard. Or 'seq-map.'

So previously, we passed a list of xrefs to xref--show-xrefs. Now we 
pass a function that returns said list instead. It's a fairly trivial 
change by itself, so if the previous state of affairs was okay, the new 
one shouldn't require a lot of new documentation.

> If you want to avoid the (IMO imaginary) danger of
> implying there could be no other values, you can say explicitly that
> other values are possible.

That depends on the level of detail you would like. The minimal level 
description is in the docstring, and it should be fine for understanding 
any code that uses FETCHER.

There is some intermediate description in xref--create-fetcher's 
docstring, though I don't know how much it helped.

But if you want a description that goes to the lower level and describes 
*everything*, like how it uses obarray for Elisp and usually scans the 
contents of TAGS otherwise... I don't think it's helpful for 
understanding of the xref--create-fetcher variable, or the corresponding 
function arguments.

It's simply not the appropriate place for it (not sure if an "overview" 
section would be better, but the manual seems like the best place; we 
could add some extra commentary in elisp-mode.el or etags.el if the 
existing ones seem not enough).

> IOW, useful documentation should be general, but not too general.  If
> being general means refraining saying something that could potentially
> help the reader understand the software and use it, then you are
> probably on the wrong side of "too general".

On the other hand, I wouldn't want to bog the description of a fairly 
clean abstraction (if I do say that myself) with incidental details. Or 
duplicate information that's already available elsewhere.

The general way we describe our code could, of course, be improved, but 
I don't subscribe to the idea that we can have a general overview of the 
system no matter where we start reading the code.