mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
display-fn isn't actually used for filtering
This commit is contained in:
parent
3744f92ad2
commit
4470110384
32
yasnippet.el
32
yasnippet.el
@ -1600,28 +1600,22 @@ Optional PROMPT sets the prompt to use."
|
|||||||
|
|
||||||
(defun yas-dropdown-prompt (_prompt choices &optional display-fn)
|
(defun yas-dropdown-prompt (_prompt choices &optional display-fn)
|
||||||
(when (fboundp 'dropdown-list)
|
(when (fboundp 'dropdown-list)
|
||||||
(let* ((formatted-choices (if display-fn (delete-if-not display-fn choices)
|
(let* ((formatted-choices
|
||||||
choices))
|
(if display-fn (mapcar display-fn choices) choices))
|
||||||
(filtered-choices (if display-fn (mapcar display-fn filtered-choices)
|
(n (dropdown-list formatted-choices)))
|
||||||
choices))
|
(if n (nth n choices)
|
||||||
(n (and formatted-choices
|
|
||||||
(dropdown-list formatted-choices))))
|
|
||||||
(if n
|
|
||||||
(nth n filtered-choices)
|
|
||||||
(keyboard-quit)))))
|
(keyboard-quit)))))
|
||||||
|
|
||||||
(defun yas-completing-prompt (prompt choices &optional display-fn completion-fn)
|
(defun yas-completing-prompt (prompt choices &optional display-fn completion-fn)
|
||||||
(let* ((formatted-choices (if display-fn (delete-if-not display-fn choices)
|
(let* ((formatted-choices
|
||||||
choices))
|
(if display-fn (mapcar display-fn choices) choices))
|
||||||
(filtered-choices (if display-fn (mapcar display-fn filtered-choices)
|
(chosen (funcall (or completion-fn #'completing-read)
|
||||||
choices))
|
prompt formatted-choices
|
||||||
(chosen (and formatted-choices
|
nil 'require-match nil nil)))
|
||||||
(funcall (or completion-fn #'completing-read)
|
(if (eq choices formatted-choices)
|
||||||
prompt formatted-choices
|
chosen
|
||||||
nil 'require-match nil nil)))
|
(nth (or (position chosen formatted-choices :test #'string=) 0)
|
||||||
(position (and chosen
|
choices))))
|
||||||
(position chosen formatted-choices :test #'string=))))
|
|
||||||
(nth (or position 0) filtered-choices)))
|
|
||||||
|
|
||||||
(defun yas-no-prompt (_prompt choices &optional _display-fn)
|
(defun yas-no-prompt (_prompt choices &optional _display-fn)
|
||||||
(first choices))
|
(first choices))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user