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
28
yasnippet.el
28
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)
|
||||
(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)))
|
||||
(position (and chosen
|
||||
(position chosen formatted-choices :test #'string=))))
|
||||
(nth (or position 0) filtered-choices)))
|
||||
(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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user