diff options
| author | Juri Linkov | 2023-10-09 21:03:03 +0300 |
|---|---|---|
| committer | Juri Linkov | 2023-10-09 21:03:03 +0300 |
| commit | 2cdf80bb8f56110b45dbde3e22dfa69d6f1fdc9c (patch) | |
| tree | 20bb3dd470570083bf1093aca4f0e70150b7a112 | |
| parent | fc1f6688a2d673e6f440700b6b256de2a96d652a (diff) | |
| download | emacs-2cdf80bb8f56110b45dbde3e22dfa69d6f1fdc9c.tar.gz emacs-2cdf80bb8f56110b45dbde3e22dfa69d6f1fdc9c.zip | |
* lisp/progmodes/xref.el: Show the number of matches on mode-line (bug#66332)
(xref-num-matches-found, xref-num-matches-face, xref-mode-line-matches):
New variables.
(xref--show-xref-buffer): Set xref-num-matches-found to the length of xrefs,
and buffer-local mode-line-process to xref-mode-line-matches.
| -rw-r--r-- | lisp/progmodes/xref.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index b7bfb192d87..fd788ec8f32 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -638,6 +638,18 @@ If SELECT is non-nil, select the target window." | |||
| 638 | "Face used to highlight matches in the xref buffer." | 638 | "Face used to highlight matches in the xref buffer." |
| 639 | :version "28.1") | 639 | :version "28.1") |
| 640 | 640 | ||
| 641 | (defvar-local xref-num-matches-found 0) | ||
| 642 | |||
| 643 | (defvar xref-num-matches-face 'compilation-info | ||
| 644 | "Face name to show the number of matches on the mode line.") | ||
| 645 | |||
| 646 | (defconst xref-mode-line-matches | ||
| 647 | `(" [" (:propertize (:eval (int-to-string xref-num-matches-found)) | ||
| 648 | face ,xref-num-matches-face | ||
| 649 | help-echo "Number of matches so far") | ||
| 650 | "]")) | ||
| 651 | (put 'xref-mode-line-matches 'risky-local-variable t) | ||
| 652 | |||
| 641 | (defmacro xref--with-dedicated-window (&rest body) | 653 | (defmacro xref--with-dedicated-window (&rest body) |
| 642 | `(let* ((xref-w (get-buffer-window xref-buffer-name)) | 654 | `(let* ((xref-w (get-buffer-window xref-buffer-name)) |
| 643 | (xref-w-dedicated (window-dedicated-p xref-w))) | 655 | (xref-w-dedicated (window-dedicated-p xref-w))) |
| @@ -1235,6 +1247,8 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)." | |||
| 1235 | (xref--ensure-default-directory dd (current-buffer)) | 1247 | (xref--ensure-default-directory dd (current-buffer)) |
| 1236 | (xref--xref-buffer-mode) | 1248 | (xref--xref-buffer-mode) |
| 1237 | (xref--show-common-initialize xref-alist fetcher alist) | 1249 | (xref--show-common-initialize xref-alist fetcher alist) |
| 1250 | (setq xref-num-matches-found (length xrefs)) | ||
| 1251 | (setq mode-line-process (list xref-mode-line-matches)) | ||
| 1238 | (pop-to-buffer (current-buffer)) | 1252 | (pop-to-buffer (current-buffer)) |
| 1239 | (setq buf (current-buffer))) | 1253 | (setq buf (current-buffer))) |
| 1240 | (xref--auto-jump-first buf (assoc-default 'auto-jump alist)) | 1254 | (xref--auto-jump-first buf (assoc-default 'auto-jump alist)) |