branch: elpa/helm commit 7cd4a463153447c8dd7ad60173ccabfe8a367d55 Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@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