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

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

[elpa] master 4470110 101/177: display-fn isn't actually used for filter


From: João Távora
Subject: [elpa] master 4470110 101/177: display-fn isn't actually used for filtering
Date: Sat, 28 Mar 2015 15:41:13 +0000

branch: master
commit 44701103845fc4ae660e1587748ec661dca3b98d
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    display-fn isn't actually used for filtering
---
 yasnippet.el |   32 +++++++++++++-------------------
 1 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/yasnippet.el b/yasnippet.el
index f585b88..d21f3cb 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -1600,28 +1600,22 @@ Optional PROMPT sets the prompt to use."
 
 (defun yas-dropdown-prompt (_prompt choices &optional display-fn)
   (when (fboundp 'dropdown-list)
-    (let* ((formatted-choices (if display-fn (delete-if-not display-fn choices)
-                                choices))
-           (filtered-choices (if display-fn (mapcar display-fn 
filtered-choices)
-                               choices))
-           (n (and formatted-choices
-                   (dropdown-list formatted-choices))))
-      (if n
-          (nth n filtered-choices)
+    (let* ((formatted-choices
+            (if display-fn (mapcar display-fn choices) choices))
+           (n (dropdown-list formatted-choices)))
+      (if n (nth n choices)
         (keyboard-quit)))))
 
 (defun yas-completing-prompt (prompt choices &optional display-fn 
completion-fn)
-  (let* ((formatted-choices (if display-fn (delete-if-not display-fn choices)
-                              choices))
-         (filtered-choices (if display-fn (mapcar display-fn filtered-choices)
-                             choices))
-         (chosen (and formatted-choices
-                      (funcall (or completion-fn #'completing-read)
-                               prompt formatted-choices
-                               nil 'require-match nil nil)))
-         (position (and chosen
-                        (position chosen formatted-choices :test #'string=))))
-    (nth (or position 0) filtered-choices)))
+  (let* ((formatted-choices
+          (if display-fn (mapcar display-fn choices) choices))
+         (chosen (funcall (or completion-fn #'completing-read)
+                          prompt formatted-choices
+                          nil 'require-match nil nil)))
+    (if (eq choices formatted-choices)
+        chosen
+      (nth (or (position chosen formatted-choices :test #'string=) 0)
+           choices))))
 
 (defun yas-no-prompt (_prompt choices &optional _display-fn)
   (first choices))



reply via email to

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