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

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

[nongnu] elpa/helm 428d513bf1 3/3: Make helm--map-candidates-in-source m


From: ELPA Syncer
Subject: [nongnu] elpa/helm 428d513bf1 3/3: Make helm--map-candidates-in-source more generic
Date: Wed, 12 Oct 2022 01:58:59 -0400 (EDT)

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

    Make helm--map-candidates-in-source more generic
    
    and rename it to helm-map-candidates-in-source.
    Fix all calls accordingly.
    
    This allows using this function possibly in more place and not only
    for marks.
    
    FN is now called with display candidate as arg and call to
    helm-this-visible-mark is now removed (it has to be called in PRED).
---
 helm-buffers.el |  9 +++++----
 helm-files.el   | 11 ++++++-----
 helm-lib.el     | 12 ++++++------
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/helm-buffers.el b/helm-buffers.el
index 959ac6f27a..aa2a1ecfcb 100644
--- a/helm-buffers.el
+++ b/helm-buffers.el
@@ -606,10 +606,11 @@ buffers)."
            (type (or type
                      (get-text-property
                       0 'type (helm-get-selection nil 'withprop src)))))
-      (helm--map-candidates-in-source
-       src #'helm-make-visible-mark
-       (lambda (cand)
-         (eq (get-text-property 0 'type cand) type)))
+      (helm-map-candidates-in-source src
+        (lambda (_cand) (helm-make-visible-mark))
+        (lambda (cand)
+          (and (not (helm-this-visible-mark))
+               (eq (get-text-property 0 'type cand) type))))
       (helm-mark-current-line)
       (helm-display-mode-line src t)
       (when helm-marked-candidates
diff --git a/helm-files.el b/helm-files.el
index 7ddd197ac3..5d9ffe9ddd 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -2589,11 +2589,12 @@ extension."
            (file (helm-get-selection nil 'withprop src))
            (face (get-text-property 3 'face file))
            (ext  (file-name-extension file)))
-      (helm--map-candidates-in-source
-       src #'helm-make-visible-mark
-       (lambda (cand)
-         (and (eq (get-text-property 3 'face cand) face)
-              (equal ext (file-name-extension cand)))))
+      (helm-map-candidates-in-source src
+        (lambda (_cand) (helm-make-visible-mark))
+        (lambda (cand)
+          (and (not (helm-this-visible-mark))
+               (eq (get-text-property 3 'face cand) face)
+               (equal ext (file-name-extension cand)))))
       (helm-mark-current-line)
       (helm-display-mode-line src t)
       (when helm-marked-candidates
diff --git a/helm-lib.el b/helm-lib.el
index 55d0eec82f..9894781a83 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -1455,10 +1455,11 @@ Argument ALIST is an alist of associated major modes."
 
 ;;; Source processing
 ;;
-(defun helm--map-candidates-in-source (src fn pred)
+(defun helm-map-candidates-in-source (src fn pred)
   "Map over all candidates in SRC and execute FN if PRED returns non nil.
-Arg FN is a function called with no arg and PRED is a function called
-with current display part of candidate as arg."
+Arg FN and PRED are functions called with current display part of
+candidate as arg."
+  (declare (indent 1))
   (save-excursion
     (goto-char (helm-get-previous-header-pos))
     (helm-next-line)
@@ -1472,9 +1473,8 @@ with current display part of candidate as arg."
       (while (< (point) maxpoint)
         (helm-mark-current-line)
         (let ((cand (helm-get-selection nil 'withprop src)))
-          (when (and (not (helm-this-visible-mark))
-                     (funcall pred cand))
-            (funcall fn)))
+          (when (funcall pred cand)
+            (funcall fn cand)))
         (forward-line 1) (end-of-line)))))
 
 ;;; Files routines



reply via email to

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