branch: master
commit 7109ce00c7637f1ca20bbf4009660fe9f76cd9c5
Author: Basil L. Contovounesios <[email protected]>
Commit: Basil L. Contovounesios <[email protected]>
ivy.el (ivy-add-actions): Delete action dups by key
---
ivy.el | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/ivy.el b/ivy.el
index 32135f2..d2fa15c 100644
--- a/ivy.el
+++ b/ivy.el
@@ -226,13 +226,14 @@ act as if `ivy-completing-read-handlers-alist' is empty.")
(plist-put ivy--actions-list cmd actions)))
(defun ivy-add-actions (cmd actions)
- "Add CMD extra exit points to ACTIONS."
+ "Add extra exit points ACTIONS to CMD.
+Existing exit points of CMD are overwritten by those in
+ACTIONS that have the same key."
(setq ivy--actions-list
(plist-put ivy--actions-list cmd
- (delete-dups
- (append
- actions
- (plist-get ivy--actions-list cmd))))))
+ (cl-delete-duplicates
+ (append (plist-get ivy--actions-list cmd) actions)
+ :key #'car :test #'equal))))
(defvar ivy--prompts-list nil)