unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#66332: Xref mode-line
@ 2023-10-04  6:20 Juri Linkov
  2023-10-04 11:35 ` Dmitry Gutov
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2023-10-04  6:20 UTC (permalink / raw)
  To: 66332

grep-mode shows the number of matches on the mode-line.

Could xref do the same?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#66332: Xref mode-line
  2023-10-04  6:20 bug#66332: Xref mode-line Juri Linkov
@ 2023-10-04 11:35 ` Dmitry Gutov
  2023-10-04 16:59   ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2023-10-04 11:35 UTC (permalink / raw)
  To: Juri Linkov, 66332

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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#66332: Xref mode-line
  2023-10-04 11:35 ` Dmitry Gutov
@ 2023-10-04 16:59   ` Juri Linkov
  2023-10-04 17:18     ` Dmitry Gutov
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2023-10-04 16:59 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 66332

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?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#66332: Xref mode-line
  2023-10-04 16:59   ` Juri Linkov
@ 2023-10-04 17:18     ` Dmitry Gutov
  2023-10-06  6:59       ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2023-10-04 17:18 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 66332

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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#66332: Xref mode-line
  2023-10-04 17:18     ` Dmitry Gutov
@ 2023-10-06  6:59       ` Juri Linkov
  2023-10-06 10:10         ` Dmitry Gutov
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2023-10-06  6:59 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 66332

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

>>>> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xref-num-matches-found.patch --]
[-- Type: text/x-diff, Size: 1320 bytes --]

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))

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#66332: Xref mode-line
  2023-10-06  6:59       ` Juri Linkov
@ 2023-10-06 10:10         ` Dmitry Gutov
  2023-10-09 18:03           ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2023-10-06 10:10 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 66332

On 06/10/2023 09:59, Juri Linkov wrote:
> Ok, here is the initial version based on grep/compilation variables:

Looking good, thanks!





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#66332: Xref mode-line
  2023-10-06 10:10         ` Dmitry Gutov
@ 2023-10-09 18:03           ` Juri Linkov
  0 siblings, 0 replies; 7+ messages in thread
From: Juri Linkov @ 2023-10-09 18:03 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 66332

close 66332 30.0.50
thanks

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

So pushed and closed.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-09 18:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04  6:20 bug#66332: Xref mode-line Juri Linkov
2023-10-04 11:35 ` Dmitry Gutov
2023-10-04 16:59   ` Juri Linkov
2023-10-04 17:18     ` Dmitry Gutov
2023-10-06  6:59       ` Juri Linkov
2023-10-06 10:10         ` Dmitry Gutov
2023-10-09 18:03           ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).