From e6fff091f2c179fa4b48514d1b3dcab9fb8fee18 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 10 Dec 2015 21:37:06 -0500 Subject: [PATCH] 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. --- yasnippet.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index b74cc10..2a28010 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -216,7 +216,7 @@ If nil, don't use any snippet." (defcustom yas-prompt-functions '(yas-x-prompt yas-dropdown-prompt yas-completing-prompt - yas-ido-prompt + yas-maybe-ido-prompt yas-no-prompt) "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))))) (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) - (when (and (fboundp 'ido-completing-read) - (or (>= emacs-major-version 24) - ido-mode)) - (yas-completing-prompt prompt choices display-fn #'ido-completing-read))) + (require 'ido) + (yas-completing-prompt prompt choices display-fn #'ido-completing-read)) (defun yas-dropdown-prompt (_prompt choices &optional display-fn) (when (fboundp 'dropdown-list)