[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2c57036 263/399: ivy.el (ivy-call): Modify the API for ivy
From: |
Oleh Krehel |
Subject: |
[elpa] master 2c57036 263/399: ivy.el (ivy-call): Modify the API for ivy-action second arg |
Date: |
Sat, 20 Jul 2019 14:57:36 -0400 (EDT) |
branch: master
commit 2c570362714f9eeb803bee1320f147cc8b682311
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-call): Modify the API for ivy-action second arg
* ivy.el (ivy-call): The second arg in `ivy-action' must be called
"marked-candidades" in order to be recognized. This is to allow the
built-in functions such as `find-file-other-window' to be re-used as
actions. The function in question, `find-file-other-window', already
has 2 arguments, so it was mistaken for an action with the
marked-candidates logic.
(ivy-mark): Document `marked-candidates'.
Re #561
Fixes #2068
---
ivy.el | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/ivy.el b/ivy.el
index ce53a9a..9919981 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1330,10 +1330,13 @@ will be called for each element of this list.")
(setq ivy-marked-candidates
(mapcar (lambda (s) (substring s l))
ivy-marked-candidates))
- (if (> (length (help-function-arglist action)) 1)
- (funcall action x ivy-marked-candidates)
- (dolist (c ivy-marked-candidates)
- (funcall action c))))
+ (let ((arglist (help-function-arglist action)))
+ (if (and (> (length arglist) 1)
+ (member 'marked-candidates arglist))
+ (funcall action x ivy-marked-candidates)
+ (dolist (c ivy-marked-candidates)
+ (let ((default-directory
(ivy-state-directory ivy-last)))
+ (funcall action c))))))
(funcall action x))
(ivy-recursive-restore))
(unless (or (eq ivy-exit 'done)
@@ -4578,7 +4581,16 @@ EVENT gives the mouse position."
(append ivy-marked-candidates (list marked-cand)))))
(defun ivy-mark ()
- "Mark the selected candidate and move to the next one."
+ "Mark the selected candidate and move to the next one.
+
+In `ivy-call', `ivy-action' will be called in turn for all marked
+candidates.
+
+However, if `ivy-action' has a second (optional) argument called
+`marked-candidates', then `ivy-action' will be called with two
+arguments: the current candidate and the list of all marked
+candidates. This way, `ivy-action' can make decisions based on
+the whole marked list."
(interactive)
(unless (ivy--marked-p)
(ivy--mark (ivy-state-current ivy-last)))
- [elpa] master e04b10c 248/399: swiper.el (swiper-isearch-function): Refactor, (continued)
- [elpa] master e04b10c 248/399: swiper.el (swiper-isearch-function): Refactor, Oleh Krehel, 2019/07/20
- [elpa] master ee71733 247/399: ivy.el (ivy-switch-buffer-other-window): Fix ivy-use-virtual-buffers, Oleh Krehel, 2019/07/20
- [elpa] master b05ae24 254/399: swiper.el (swiper--add-properties): Extract, Oleh Krehel, 2019/07/20
- [elpa] master db3e307 250/399: swiper.el (swiper--isearch-format): Extract, Oleh Krehel, 2019/07/20
- [elpa] master 58b6f7d 257/399: swiper.el (swiper--isearch-format): Don't use blending for the current match, Oleh Krehel, 2019/07/20
- [elpa] master f628441 259/399: swiper.el (swiper-isearch): Fix "C-r", Oleh Krehel, 2019/07/20
- [elpa] master 743163c 260/399: counsel.el (counsel-minor-history): New history variable, Oleh Krehel, 2019/07/20
- [elpa] master cbb3ee1 262/399: counsel.el (counsel-company): Don't rely on company-point, Oleh Krehel, 2019/07/20
- [elpa] master 77a5ffc 261/399: counsel.el (counsel-package-history): New history variable, Oleh Krehel, 2019/07/20
- [elpa] master d5c9673 265/399: swiper.el (swiper--isearch-format): Fix permanent face modifications, Oleh Krehel, 2019/07/20
- [elpa] master 2c57036 263/399: ivy.el (ivy-call): Modify the API for ivy-action second arg,
Oleh Krehel <=
- [elpa] master bea44b7 264/399: counsel.el: Fix compiler warnings, Oleh Krehel, 2019/07/20
- [elpa] master a2af29b 271/399: ivy.el (ivy--occur-insert-lines): Fix missing line numbers, Oleh Krehel, 2019/07/20
- [elpa] master 9a9e3e4 251/399: ivy-test.el (swiper--isearch-format): Add test, Oleh Krehel, 2019/07/20
- [elpa] master 76ef143 258/399: swiper.el (swiper-isearch): Fix ivy-occur, Oleh Krehel, 2019/07/20
- [elpa] master c6977eb 266/399: ivy.el (ivy-read): Add :multi-action arg, Oleh Krehel, 2019/07/20
- [elpa] master df0d980 267/399: Modify counsel-unicode-char's copy action to use actual result, Oleh Krehel, 2019/07/20
- [elpa] master 19ff7cf 270/399: counsel.el (counsel-register-action): Tweak error, Oleh Krehel, 2019/07/20
- [elpa] master 4898a5e 272/399: counsel.el (counsel-compile): better handling for counsel--get-build-subdirs, Oleh Krehel, 2019/07/20
- [elpa] master e95a16b 275/399: Shrink ivy window after read action., Oleh Krehel, 2019/07/20
- [elpa] master 226171b 268/399: ivy.el (ivy--occur-insert-lines): Don't highlight the file name part, Oleh Krehel, 2019/07/20