GNU bug report logs - #71466
30.0.50; Buffer-menu-group-by non-nil resets point when Buffer List is reverted

Previous Next

Package: emacs;

Reported by: Eshel Yaron <me <at> eshelyaron.com>

Date: Mon, 10 Jun 2024 10:26:02 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 30.1

Done: Eshel Yaron <me <at> eshelyaron.com>

Bug is archived. No further changes may be made.

Full log


Message #41 received at 71466 <at> debbugs.gnu.org (full text, mbox):

From: Eshel Yaron <me <at> eshelyaron.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: dmitry <at> gutov.dev, 71466 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#71466: 30.0.50; Buffer-menu-group-by non-nil resets point
 when Buffer List is reverted
Date: Tue, 18 Jun 2024 16:01:40 +0200
Hi Eli,

Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: 71466 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
>> Date: Tue, 18 Jun 2024 09:00:38 +0200
>> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>>  @item g
>> -@findex xref-revert-buffer
>> -Refresh the contents of the @file{*xref*} buffer
>> -(@code{xref-revert-buffer}).
>> +Refresh the contents of the @file{*xref*} buffer (@code{revert-buffer}).
>> +@xref{Reverting}.
>
> Why remove the index entry?  It needs to be rewritten, not removed.

The index entry is for xref-revert-buffer, which we're making obsolete
here in favor of revert-buffer, which has its own index entry elsewhere.
How do you suggest rewriting it instead?

>> +** Xref
>> +
>> +*** 'xref-revert-buffer' is obsolete, prefer 'revert-buffer' instead.
>> +The former is now an alias of the latter.  The Xref results buffer sets
>
> Please use "The Xref buffer".  "The Xref results buffer" reads
> awkwardly, and there actually is no such thing as "Xref results".

All right, will do.

>> @@ -1011,6 +1010,7 @@ xref--xref-buffer-mode
>>          #'xref--imenu-extract-index-name)
>>    (setq-local add-log-current-defun-function
>>                #'xref--add-log-current-defun)
>> +  (setq-local revert-buffer-function #'xref--revert-buffer)
>>    (setq-local outline-minor-mode-cycle t)
>>    (setq-local outline-minor-mode-use-buttons 'insert)
>>    (setq-local outline-search-function
>> @@ -1273,22 +1273,16 @@ xref--show-common-initialize
>>            xref--original-window-intent (assoc-default 'display-action alist))
>>      (setq xref--fetcher fetcher)))
>>  
>> -(defun xref-revert-buffer ()
>> +(defun xref--revert-buffer (&rest _)     ; Ignore `revert-buffer' args.
>>    "Refresh the search results in the current buffer."
>
> And I wonder why you preferred a backward-incompatible change to a
> backward-compatible one:

This is intended to be (basically) fully backward-compatible:
xref-revert-buffer becomes an alias of revert-buffer, which does exactly
what xref-revert-buffer would do.

> leave the function's name alone, and just set up
> revert-buffer-function to invoke it.  Was this not possible for some
> technical reason that evades me?

It's possible, and it's more or less what I suggested upthread, but
Dmitry correctly noted that this approach (using xref--revert-buffer)
improves backward-compatibility in the following sense: users that
currently invoke xref-revert-buffer not by pressing 'g', but in some
other way, can continue to do so and get the same behavior that now
revert-buffer provides when you press 'g'.  Since revert-buffer does
more than just calling revert-buffer-function (namely, it also runs
revert-buffer-restore-functions), making xref-revert-buffer an alias of
revert-buffer ensures invoking and xref-revert-buffer and pressing 'g'
continues to behave the same.


Eshel




This bug report was last modified 329 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.