Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ivy.el (ivy-add-actions): Delete action dups by key #1296

Merged
merged 1 commit into from
Nov 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions ivy.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this could also be

(cl-delete-duplicates
 (append actions (plist-get ivy--actions-list cmd))
 :key #'car :test #'equal :from-end t)

but that would be ever so slightly slower.


(defvar ivy--prompts-list nil)

Expand Down