From 797023b84c8829f2a16907fac4f7520a322f9c5b Mon Sep 17 00:00:00 2001 From: Rasmus Date: Mon, 20 Apr 2015 14:13:25 +0200 Subject: [PATCH] org.el: Fix 7ec8ced * org.el (org-icompleting-read): Correct bug introduced previously. --- lisp/org.el | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 8a008476d..0375b474e 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -10498,27 +10498,33 @@ from." (iswitchb-read-buffer prompt))) (defun org-icompleting-read (&rest args) - "Completing-read using `ido-mode' or `iswitchb' speedups if available." - (org-without-partial-completion - (let ((ido-enter-matching-directory nil)) - (apply - (cond ((and org-completion-use-ido - (fboundp 'ido-completing-read) - (boundp 'ido-mode) ido-mode - (listp (second args))) - 'ido-completing-read) - ((and org-completion-use-iswitchb - (boundp 'iswitchb-mode) iswitchb-mode - (listp (second args))) - 'org-iswitchb-completing-read) - (t (or (and (boundp 'completing-read-function) - completing-read-function) - 'completing-read))) - (concat (car args)) - (if (consp (car (nth 1 args))) - (mapcar 'car (nth 1 args)) - (nth 1 args)) - (cddr args))))) + "Completing-read using `ido-mode' or `iswitchb' speedups if available. + +Should be called like `completing-read'." + (let ((default-completion (or completing-read-function + completion-read))) + (org-without-partial-completion + (if (not (listp (second args))) + ;; Ido only supports lists as the COLLECTION argument. Use + ;; default completion function when second argument is not a + ;; list. + (apply default-completion args) + (let ((ido-enter-matching-directory nil)) + (apply (cond ((and org-completion-use-ido + (fboundp 'ido-completing-read) + (boundp 'ido-mode) + ido-mode) + 'ido-completing-read) + ((and org-completion-use-iswitchb + (boundp 'iswitchb-mode) + iswitchb-mode) + 'org-iswitchb-completing-read) + (t default-completion)) + (pop args) + (if (org-some 'consp (car args)) + (mapcar 'car (pop args)) + (pop args)) + args)))))) (defun org-extract-attributes (s) "Extract the attributes cookie from a string and set as text property."