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

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

[nongnu] elpa/helm 187e358493 1/6: Ensure to not collect nil candidates


From: ELPA Syncer
Subject: [nongnu] elpa/helm 187e358493 1/6: Ensure to not collect nil candidates in helm-occur-transformer
Date: Thu, 12 May 2022 04:58:30 -0400 (EDT)

branch: elpa/helm
commit 187e358493a598607d11648d76c92850bc9d69f3
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Ensure to not collect nil candidates in helm-occur-transformer
---
 helm-occur.el | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/helm-occur.el b/helm-occur.el
index f9691b1b7d..7880df5e7f 100644
--- a/helm-occur.el
+++ b/helm-occur.el
@@ -247,17 +247,22 @@ engine beeing completely different and also much faster."
 (defun helm-occur-transformer (candidates source)
   "Return CANDIDATES prefixed with line number."
   (cl-loop with buf = (helm-get-attr 'buffer-name source)
-           for c in candidates collect
-           (when (string-match helm-occur--search-buffer-regexp c)
-             (let ((linum (match-string 1 c))
-                   (disp (match-string 2 c)))
-               (cons (format "%s:%s"
-                             (propertize
-                              linum 'face 'helm-grep-lineno
-                              'help-echo (buffer-file-name
-                                          (get-buffer buf)))
-                             disp)
-                     (string-to-number linum))))))
+           for c in candidates
+           for cand = (when (string-match helm-occur--search-buffer-regexp c)
+                        (let ((linum (match-string 1 c))
+                              (disp  (match-string 2 c)))
+                          (when (and disp (not (string= disp "")))
+                            (cons (concat
+                                   (propertize " " 'display
+                                               (concat
+                                                (propertize
+                                                 linum 'face 'helm-grep-lineno
+                                                 'help-echo (buffer-file-name
+                                                             (get-buffer buf)))
+                                                ":"))
+                                   disp)
+                                  (string-to-number linum)))))
+           when cand collect cand))
 
 (defclass helm-moccur-class (helm-source-in-buffer)
   ((buffer-name :initarg :buffer-name



reply via email to

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