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

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

[nongnu] elpa/helm 7cd4a46315: Fix helm-occur transformer issue #2526


From: ELPA Syncer
Subject: [nongnu] elpa/helm 7cd4a46315: Fix helm-occur transformer issue #2526
Date: Tue, 28 Jun 2022 06:58:34 -0400 (EDT)

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

    Fix helm-occur transformer issue #2526
    
    Avoid empty or nil candidates while not breaking nearest position.
---
 helm-occur.el | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/helm-occur.el b/helm-occur.el
index 365b3b03fb..b46f78fce7 100644
--- a/helm-occur.el
+++ b/helm-occur.el
@@ -252,17 +252,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 disp-linum = (when (string-match 
helm-occur--search-buffer-regexp c)
+                              (let ((linum (match-string 1 c))
+                                    (disp (match-string 2 c)))
+                                (list
+                                 linum
+                                 (format "%s:%s"
+                                         (propertize
+                                          linum 'face 'helm-grep-lineno
+                                          'help-echo (buffer-file-name
+                                                      (get-buffer buf)))
+                                         disp))))
+           for linum = (car disp-linum)
+           for disp = (cadr disp-linum)
+           when (and disp (not (string= disp "")))
+           collect (cons disp (string-to-number linum))))
 
 (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]