[Top][All Lists]

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

[elpa] master ccae030: Improve summary message of `el-search-overview'

From: Michael Heerdegen
Subject: [elpa] master ccae030: Improve summary message of `el-search-overview'
Date: Fri, 20 Jan 2017 00:46:56 +0000 (UTC)

branch: master
commit ccae0309163f128314cf45487da59be3da95dadc
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>

    Improve summary message of `el-search-overview'
 packages/el-search/el-search.el |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index b8c0abe..70b1acf 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -1681,7 +1681,8 @@ With prefix arg, restart the current search."
 (defun el-search--occur (search)
   ;; This is a poorly written stub!
   (cl-letf ((occur-buffer (generate-new-buffer "*El Occur*"))
-            (last nil) (matches nil) (overall-matches 0)
+            (last nil) (matches nil)
+            (matching-files 0) (matching-buffers 0) (overall-matches 0)
             (el-search-keep-hl t)
             ((symbol-function 'el-search-hl-remove) #'ignore))
     (setq this-command 'el-search-pattern)
@@ -1700,10 +1701,18 @@ With prefix arg, restart the current search."
                    (when matches (insert (format "%3d matches in %S\n" matches 
(or (cadr last) (car last)))))
                    (setq last (list buffer file))
-                   (setq matches 1)))
+                   (setq matches 1)
+                   (if file (cl-incf matching-files) (when buffer (cl-incf 
                (stream-append (el-search-object-matches 
(el-search-reset-search search))
                               (stream (list (list nil nil nil)))))
-              (insert (format "\n\n%d matches in total." overall-matches))
+              (insert
+               (if (zerop overall-matches)
+                   "No matches"
+                 (concat
+                  (format "\n\n%d matches in " overall-matches)
+                  (unless (zerop matching-files) (format "%d files" 
+                  (unless (or (zerop matching-files) (zerop matching-buffers)) 
" and ")
+                  (unless (zerop matching-buffers)  (format "%d buffers" 
               (setq done t))
           (unless done (insert "\n\nAborted."))
           (el-search--message-no-log ""))))))

reply via email to

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