branch: scratch/mheerdegen-preview commit 2ec7a9eb3a01251126f4c2f879be249a2090c4e0 Author: Michael Heerdegen <[email protected]> Commit: Michael Heerdegen <[email protected]>
WIP: More colorful match count
---
packages/el-search/el-search.el | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 4e403b3..b0af521 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -2586,17 +2586,23 @@ created.")
buffer-or-file
matches-<=-here
total-matches
- (propertize
- (format (pcase (save-excursion
- (goto-char (car
defun-bounds))
- (el-search-read
(current-buffer)))
- (`(,a ,b . ,_) (format "(%s
%%d/%%d)"
-
(truncate-string-to-width
- (format
"%S %S" a b)
- 40 nil
nil 'ellipsis)))
- (_ "(%d/%d)"))
- matches-<=-here-in-defun
total-matches-in-defun)
- 'face 'shadow))))
+ (format
+ (pcase (save-excursion
+ (goto-char (car defun-bounds))
+ (and (el-search-looking-at '`(,_
,_ . ,_))
+ (let ((region (list
+ (progn
(down-list) (point))
+ (min
(line-end-position)
+
(scan-sexps (point) 2)))))
+ (apply
#'jit-lock-fontify-now region)
+ (apply #'buffer-substring
region))))
+ ((and (pred stringp) signature)
+ (format "(%s %%d/%%d)"
+ (truncate-string-to-width
+ signature
+ 40 nil nil 'ellipsis)))
+ (_ "(%d/%d)"))
+ matches-<=-here-in-defun
total-matches-in-defun))))
(list
(concat (if (not just-count) "[Not at a match]
" "")
(if (= matches-<=-here total-matches)
