From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74313: [PATCH] Update 'xref-num-matches-found' when reverting *xref* buffer Date: Mon, 11 Nov 2024 20:16:22 +0100 Message-ID: Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16604"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Dmitry Gutov To: 74313@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 11 20:17:22 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 1tAZub-00049c-Ri for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Nov 2024 20:17:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAZuM-0005Jw-7H; Mon, 11 Nov 2024 14:17:06 -0500 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 1tAZuI-0005G2-TA for bug-gnu-emacs@gnu.org; Mon, 11 Nov 2024 14:17:04 -0500 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 1tAZuI-00073z-GG for bug-gnu-emacs@gnu.org; Mon, 11 Nov 2024 14:17:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=z9Zi4Fp/s52p73L5lMMyzV7eF9GDQEZhp3tjqR/tFXE=; b=Kgnj5g4r37DvEH46twZNqcB/+BNY0Wihod/vU/sAWGzl++L5ovUdoNo/ETyk1XlIs7VC5A/W8laUhrFf4sIU9fPxyznuwikj4bPl33Em5qwfPhyCLMAUpnY/J270Dz1r0/glQC95HlyugVlqI9EN0TtYYZFVhj8wpbmK+RQg57eKbhwtiQ4WVbdT8Ju7c3vLE1txx2wNTIU4oZAgHU1oZqFIp0Hr2TAb2FsM7qYiaZOgDHvoXk3FV4uCO8i/FftT3WcUW2IkauIJz/e7vBdAUQVlvUaJ5CxWoEQaTBQV0XeKGkbEKGQF1aT/8/2XmnjktIKQoRyZfg0dF7MWtutHIg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tAZuI-0007Sb-0s; Mon, 11 Nov 2024 14:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: dmitry@gutov.dev, bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Nov 2024 19:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74313 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Dmitry Gutov Original-Received: via spool by submit@debbugs.gnu.org id=B.173135259328620 (code B ref -1); Mon, 11 Nov 2024 19:17:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Nov 2024 19:16:33 +0000 Original-Received: from localhost ([127.0.0.1]:59206 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAZtp-0007RX-01 for submit@debbugs.gnu.org; Mon, 11 Nov 2024 14:16:33 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:59248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAZtm-0007RK-AC for submit@debbugs.gnu.org; Mon, 11 Nov 2024 14:16:30 -0500 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 1tAZtj-00051E-SR for bug-gnu-emacs@gnu.org; Mon, 11 Nov 2024 14:16:28 -0500 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAZti-0006zP-Fx for bug-gnu-emacs@gnu.org; Mon, 11 Nov 2024 14:16:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1731352585; bh=zZW1ErpcrPnigC34ZoAPtcccvG9cLY/nMULfBuCyCDo=; h=From:To:Subject:Date:From; b=w4q9JrBZ5V6y1nQYaAYckAQdZTkeAaBCu21h96/zErQqNXLhHYzgPC1ricyTxmS7x MsGo4MPy4ijCearqwv+ZyoZ5z8+hplnGYVZp26EiFmdUNN7hx2lgjQot32CIxlzQli WK9lv9CFu5N9M5MtIHfXKJIZmBoZattKMKbZjyp9Vc0TRfNJQchoE4ERGDl4XSQ0Zr 0ppuugsTSCqhT+Ea6XFXch5hoj66+l3xhzEU+DpOkq5TWfjf0VUOgvEZW7nz5R+M8+ hMUrOF+kma9tn3MYWCBUr4hRw0dAz5JzW5LrhG7p9t0FIHyJ1p1075rPEhdRrtag4N AROPv0J6L8Yyg== X-Hashcash: 1:20:241111:bug-gnu-emacs@gnu.org::oXCRf1JNrggI6Oo6:0uvw Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:295236 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Hi, The *xref* buffer displays the number of found matches in the mode line. With this patch, it also updates that number, stored in variable xref-num-matches-found, when you revert the buffer. That way the mode line shows the updated number of matches when you add or delete some references and revert the *xref* buffer. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Update-xref-num-matches-found-when-reverting-xref-bu.patch >From 47fb809c858ee4fb18283350a4af6d9c7c33a8fb Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Mon, 11 Nov 2024 19:45:10 +0100 Subject: [PATCH] Update 'xref-num-matches-found' when reverting *xref* buffer * lisp/progmodes/xref.el (xref--insert-xrefs): Update 'xref-num-matches-found' here... (xref--show-xref-buffer): ...instead of here. --- lisp/progmodes/xref.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index cc06e06ef78..cf061a18ee0 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1139,6 +1139,7 @@ xref--insert-xrefs GROUP is a string for decoration purposes and XREF is an `xref-item' object." (require 'compile) ; For the compilation faces. + (setq xref-num-matches-found 0) (cl-loop for (group . xrefs) in xref-alist for max-line = (cl-loop for xref in xrefs maximize (xref-location-line @@ -1158,6 +1159,7 @@ xref--insert-xrefs (xref--insert-propertized '(face xref-file-header xref-group t) group "\n") (dolist (xref xrefs) + (cl-incf xref-num-matches-found) (pcase-let (((cl-struct xref-item summary location) xref)) (let* ((line (xref-location-line location)) (prefix @@ -1247,7 +1249,6 @@ xref--show-xref-buffer (xref--ensure-default-directory dd (current-buffer)) (xref--xref-buffer-mode) (xref--show-common-initialize xref-alist fetcher alist) - (setq xref-num-matches-found (length xrefs)) (setq mode-line-process (list xref-mode-line-matches)) (pop-to-buffer (current-buffer)) (setq buf (current-buffer))) -- 2.46.2 --=-=-=--