From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#71466: 30.0.50; Buffer-menu-group-by non-nil resets point when Buffer List is reverted Date: Tue, 18 Jun 2024 01:24:26 +0300 Message-ID: References: <86tthzwgsw.fsf@mail.linkov.net> <86msnkyt7c.fsf@mail.linkov.net> <30404984-e7ac-4f92-a194-06438dbf2d03@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23809"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 71466@debbugs.gnu.org, Juri Linkov To: Eshel Yaron Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 18 00:25:17 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sJKmq-0005xg-9T for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Jun 2024 00:25:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJKmb-0001zU-H5; Mon, 17 Jun 2024 18:25:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJKma-0001z3-Gz for bug-gnu-emacs@gnu.org; Mon, 17 Jun 2024 18:25:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJKma-0007J2-6A for bug-gnu-emacs@gnu.org; Mon, 17 Jun 2024 18:25:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sJKmc-0006pi-DF for bug-gnu-emacs@gnu.org; Mon, 17 Jun 2024 18:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Jun 2024 22:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71466 X-GNU-PR-Package: emacs Original-Received: via spool by 71466-submit@debbugs.gnu.org id=B71466.171866308126227 (code B ref 71466); Mon, 17 Jun 2024 22:25:02 +0000 Original-Received: (at 71466) by debbugs.gnu.org; 17 Jun 2024 22:24:41 +0000 Original-Received: from localhost ([127.0.0.1]:38247 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJKmG-0006ow-Le for submit@debbugs.gnu.org; Mon, 17 Jun 2024 18:24:41 -0400 Original-Received: from wfhigh6-smtp.messagingengine.com ([64.147.123.157]:59625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJKmD-0006oc-O0 for 71466@debbugs.gnu.org; Mon, 17 Jun 2024 18:24:38 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.west.internal (Postfix) with ESMTP id 9743118000B1; Mon, 17 Jun 2024 18:24:29 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 17 Jun 2024 18:24:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1718663069; x=1718749469; bh=9cp5iTMvAxMkLT+yl5dCohbuAlKE08t/yk1+bVn8hRE=; b= gtesx1CHJvFoiSxa3f3UtsYV8367ZW2JGk6TLCJ1iwCEKCqnBE4pSoKLnJX/f8AE xZU9kfxeOZsP15rn94JVFBK91ffh4cyqqEnZGvoCSdGSBjt7eCpWK/RWOlIzwhhl Z8noaE9Xrb3FHfk2Hji8D2uPIt7BqokzB8iqhjRAmrQQHNZUU7XeSSrDZBCyEALp +ifIVyLBgXPqEvvIZFU7eCnXagj5h+aipNuJil9ptBo/cE+h9cTJfC2+L6YgGyhv 7qfZCFp/YDrV6YoUzT6SnlTvOCGin3hMHCIYp3DFcvy+S7M5wywg634mJtWckDo+ 8RvtpdRaK+w6BstdqQGCeA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1718663069; x= 1718749469; bh=9cp5iTMvAxMkLT+yl5dCohbuAlKE08t/yk1+bVn8hRE=; b=J i6GEpMRfNoUQ8sjNxP06qqUvx6YMi1us4fSZWjnv9VZt6x3nFmYG4PidHXtkO4YK 0+vInSXIJFfLSFHSHhsf3Uw01P479j7cDPS3pEG/DIN3BFVUx+/XIU0aXBBhm3AT 5jQYzvwBNXNXHhm2bLThwwTYFp2FDcNHCr2uE5fnb3OGWAoSX4V/ttR0cvoDr6B3 JDoqUjLhyHhcQg0p7iNz5mrbaV5gbool7HpvUsJeGvG4tHHDvNeNHuI5A7fOiPNZ p5kJTqqH+5z4v6Nw3CdSlmISddjZN/5iyVlw6ZEFOENv/XP59eTQzeOwBqstjXqU A+x6qNC64+HBY7rXupUaQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedviedgtdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepteduleejgeehtefgheegjeekueehvdevieekueeftddvtdevfefhvdevgedu jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 17 Jun 2024 18:24:27 -0400 (EDT) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287423 Archived-At: On 17/06/2024 18:43, Eshel Yaron wrote: > Dmitry Gutov writes: > >> On 17/06/2024 10:40, Eshel Yaron wrote: >>>>> But this will not handle modes that don't use tabulated-list. >>>>> For example, reverting an xref buffer with outlines now restores >>>>> visibility of outlines, but doesn't restore point. OTOH, maybe it's >>>>> not responsibility of outline-minor-mode to restore point when it's >>>>> not on a heading line. >>>> For xref I propose a separate patch that keeps point on the same line >>>> after reverting the xref buffer: >>> LGTM, but FWIW the situation with xref-revert-buffer is not ideal IMO: >>> it might be cleaner to leave 'g' bound to the usual revert-buffer and >>> set revert-buffer-function to (a slightly modified) xref-revert-buffer. >>> That way xref-revert-buffer wouldn't need to duplicate generic parts of >>> revert-buffer, such as running revert-buffer-restore-functions. WDYT? >> >> I'm okay with that. > > Here's a concrete proposal: Thanks, works for me, with some caveats. > diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el > index fb6c9dad73b..9878806c0de 100644 > --- a/lisp/progmodes/xref.el > +++ b/lisp/progmodes/xref.el > @@ -993,7 +993,6 @@ xref--xref-buffer-mode-map > ;; suggested by Johan Claesson "to further reduce finger movement": > (define-key map (kbd ".") #'xref-next-line) > (define-key map (kbd ",") #'xref-prev-line) > - (define-key map (kbd "g") #'xref-revert-buffer) > (define-key map (kbd "M-,") #'xref-quit-and-pop-marker-stack) > map)) > > @@ -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,17 @@ 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." > (interactive) It seems like the interactive use of 'xref-revert-buffer' would suffer with this change (it wouldn't call the restore functions). And it might be used where people rebind it to a different key in their configs. Perhaps instead xref-revert-buffer should become an obsolete alias to 'revert-buffer'. And the current definition would be renamed to xref--revert-buffer (which we'll set revert-buffer-function to).