Don't choose ido prompting based on Emacs version

* yasnippet.el (yas-ido-prompt): Unconditionally use ido prompting,
  explicitly requireing ido.
(yas-maybe-ido-prompt): New function, call `yas-ido-prompt' if
`ido-mode' is enabled.
(yas-prompt-functions): Replace `yas-ido-prompt' with
`yas-maybe-ido-prompt' in the default value.
This commit is contained in:
Noam Postavsky 2015-12-10 21:37:06 -05:00
parent 61261c9bb4
commit e6fff091f2

View File

@ -216,7 +216,7 @@ If nil, don't use any snippet."
(defcustom yas-prompt-functions '(yas-x-prompt (defcustom yas-prompt-functions '(yas-x-prompt
yas-dropdown-prompt yas-dropdown-prompt
yas-completing-prompt yas-completing-prompt
yas-ido-prompt yas-maybe-ido-prompt
yas-no-prompt) yas-no-prompt)
"Functions to prompt for keys, templates, etc interactively. "Functions to prompt for keys, templates, etc interactively.
@ -1585,11 +1585,13 @@ Optional PROMPT sets the prompt to use."
(if display-fn (mapcar display-fn choices) choices))))) (if display-fn (mapcar display-fn choices) choices)))))
(keyboard-quit)))) (keyboard-quit))))
(defun yas-maybe-ido-prompt (prompt choices &optional display-fn)
(when (bound-and-true-p ido-mode)
(yas-ido-prompt prompt choices display-fn)))
(defun yas-ido-prompt (prompt choices &optional display-fn) (defun yas-ido-prompt (prompt choices &optional display-fn)
(when (and (fboundp 'ido-completing-read) (require 'ido)
(or (>= emacs-major-version 24) (yas-completing-prompt prompt choices display-fn #'ido-completing-read))
ido-mode))
(yas-completing-prompt prompt choices display-fn #'ido-completing-read)))
(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)