GNU bug report logs - #66332
Xref mode-line

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Wed, 4 Oct 2023 06:23:01 UTC

Severity: wishlist

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66332 in the body.
You can then email your comments to 66332 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#66332; Package emacs. (Wed, 04 Oct 2023 06:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 04 Oct 2023 06:23:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Xref mode-line
Date: Wed, 04 Oct 2023 09:20:39 +0300
grep-mode shows the number of matches on the mode-line.

Could xref do the same?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66332; Package emacs. (Wed, 04 Oct 2023 11:36:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>, 66332 <at> debbugs.gnu.org
Subject: Re: bug#66332: Xref mode-line
Date: Wed, 4 Oct 2023 14:35:05 +0300
On 04/10/2023 09:20, Juri Linkov wrote:
> grep-mode shows the number of matches on the mode-line.
> 
> Could xref do the same?

Certainly.

This should be especially useful later, when we make it update 
asynchronously.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66332; Package emacs. (Wed, 04 Oct 2023 17:10:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 66332 <at> debbugs.gnu.org
Subject: Re: bug#66332: Xref mode-line
Date: Wed, 04 Oct 2023 19:59:06 +0300
severity 66332 wishlist
thanks

>> grep-mode shows the number of matches on the mode-line.
>> Could xref do the same?
>
> Certainly.
>
> This should be especially useful later, when we make it update
> asynchronously.

Should I look into the implementation, or you already know how it could work?




Severity set to 'wishlist' from 'normal' Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Wed, 04 Oct 2023 17:10:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66332; Package emacs. (Wed, 04 Oct 2023 17:19:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: 66332 <at> debbugs.gnu.org
Subject: Re: bug#66332: Xref mode-line
Date: Wed, 4 Oct 2023 20:18:00 +0300
On 04/10/2023 19:59, Juri Linkov wrote:
>>> grep-mode shows the number of matches on the mode-line.
>>> Could xref do the same?
>> Certainly.
>>
>> This should be especially useful later, when we make it update
>> asynchronously.
> Should I look into the implementation, or you already know how it could work?

I might not get around to this until after the next few weeks, so you're 
welcome to take initiative.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66332; Package emacs. (Fri, 06 Oct 2023 07:33:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 66332 <at> debbugs.gnu.org
Subject: Re: bug#66332: Xref mode-line
Date: Fri, 06 Oct 2023 09:59:51 +0300
[Message part 1 (text/plain, inline)]
>>>> grep-mode shows the number of matches on the mode-line.
>>>> Could xref do the same?
>>> Certainly.
>>>
>>> This should be especially useful later, when we make it update
>>> asynchronously.
>> Should I look into the implementation, or you already know how it could work?
>
> I might not get around to this until after the next few weeks, so you're
> welcome to take initiative.

Ok, here is the initial version based on grep/compilation variables:

[xref-num-matches-found.patch (text/x-diff, inline)]
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index b7bfb192d87..dbf013bdba2 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -626,6 +626,18 @@ xref-pop-to-location
 (defconst xref-buffer-name "*xref*"
   "The name of the buffer to show xrefs.")
 
+(defvar-local xref-num-matches-found 0)
+
+(defvar xref-num-matches-face 'compilation-info
+  "Face name to show the number of matches on the mode line.")
+
+(defconst xref-mode-line-matches
+  `(" [" (:propertize (:eval (int-to-string xref-num-matches-found))
+                      face ,xref-num-matches-face
+                      help-echo "Number of matches so far")
+    "]"))
+(put 'xref-mode-line-matches 'risky-local-variable t)
+
 (defface xref-file-header '((t :inherit compilation-info))
   "Face used to highlight file header in the xref buffer."
   :version "27.1")
@@ -1235,6 +1229,8 @@ 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)))
     (xref--auto-jump-first buf (assoc-default 'auto-jump alist))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66332; Package emacs. (Fri, 06 Oct 2023 10:12:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: 66332 <at> debbugs.gnu.org
Subject: Re: bug#66332: Xref mode-line
Date: Fri, 6 Oct 2023 13:10:58 +0300
On 06/10/2023 09:59, Juri Linkov wrote:
> Ok, here is the initial version based on grep/compilation variables:

Looking good, thanks!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#66332; Package emacs. (Mon, 09 Oct 2023 18:13:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 66332 <at> debbugs.gnu.org
Subject: Re: bug#66332: Xref mode-line
Date: Mon, 09 Oct 2023 21:03:36 +0300
close 66332 30.0.50
thanks

>> Ok, here is the initial version based on grep/compilation variables:
>
> Looking good, thanks!

So pushed and closed.




bug marked as fixed in version 30.0.50, send any further explanations to 66332 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Mon, 09 Oct 2023 18:13:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 07 Nov 2023 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 224 days ago.

Previous Next


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