(yas-choose-value): Accept strings as &rest argument

This commit is contained in:
João Távora 2012-07-30 20:18:42 +01:00
parent c566c929c0
commit 71c8e0ea46

View File

@ -2749,10 +2749,16 @@ If found, the content of subexp group SUBEXP (default 0) is
(match-string-no-properties grp str) (match-string-no-properties grp str)
str)))) str))))
(defun yas-choose-value (possibilities) (defun yas-choose-avalue (&rest possibilities)
"Prompt for a string in the list POSSIBILITIES and return it." "Prompt for a string in POSSIBILITIES and return it.
The last element of POSSIBILITIES may be a list of strings."
(unless (or yas-moving-away-p (unless (or yas-moving-away-p
yas-modified-p) yas-modified-p)
(setq possibilities (nreverse possibilities))
(setq possibilities (if (listp (car possibilities))
(append (reverse (car possibilities)) (rest possibilities))
possibilities))
(some #'(lambda (fn) (some #'(lambda (fn)
(funcall fn "Choose: " possibilities)) (funcall fn "Choose: " possibilities))
yas-prompt-functions))) yas-prompt-functions)))