emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/el-search 22c2f25 297/332: [el-search] Display colored


From: Stefan Monnier
Subject: [elpa] externals/el-search 22c2f25 297/332: [el-search] Display colored defun match count
Date: Tue, 1 Dec 2020 15:49:08 -0500 (EST)

branch: externals/el-search
commit 22c2f254e3c173842b25694286d45652772ad9df
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>

    [el-search] Display colored defun match count
    
    * packages/el-search/el-search.el
    (el-search-display-match-count): Display the fontified defun signature
    in the defun match count.
---
 el-search.el | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/el-search.el b/el-search.el
index b4981fe..dc2a3f8 100644
--- a/el-search.el
+++ b/el-search.el
@@ -2708,17 +2708,25 @@ don't display anything"
                                     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 '`(,_ 
,_ . ,_))
+                                                   (looking-at "(") ;exclude 
toplevel `ATOM and sim.
+                                                   (let ((region (list
+                                                                  (progn 
(down-list) (point))
+                                                                  (min 
(line-end-position)
+                                                                       
(scan-sexps (point) 2)))))
+                                                     (when (bound-and-true-p 
jit-lock-mode)
+                                                       (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]