org.el: Small refactor

* org.el (org-icompleting-read): Support completing-read-default.
This commit is contained in:
Rasmus 2015-04-16 17:15:16 +02:00 committed by Oleh Krehel
parent acf7f47ecd
commit 7ec8ced5d6
1 changed files with 19 additions and 23 deletions

View File

@ -10502,29 +10502,25 @@ from."
(defun org-icompleting-read (&rest args) (defun org-icompleting-read (&rest args)
"Completing-read using `ido-mode' or `iswitchb' speedups if available." "Completing-read using `ido-mode' or `iswitchb' speedups if available."
(org-without-partial-completion (org-without-partial-completion
(if (and org-completion-use-ido (let ((ido-enter-matching-directory nil))
(apply
(cond ((and org-completion-use-ido
(fboundp 'ido-completing-read) (fboundp 'ido-completing-read)
(boundp 'ido-mode) ido-mode (boundp 'ido-mode) ido-mode
(listp (second args))) (listp (second args)))
(let ((ido-enter-matching-directory nil)) 'ido-completing-read)
(apply (if (eq completing-read-function ((and org-completion-use-iswitchb
'completing-read-default) (boundp 'iswitchb-mode) iswitchb-mode
'ido-completing-read (listp (second args)))
'org-iswitchb-completing-read)
(t (or (and (boundp 'completing-read-function)
completing-read-function) completing-read-function)
'completing-read)))
(concat (car args)) (concat (car args))
(if (consp (car (nth 1 args))) (if (consp (car (nth 1 args)))
(mapcar 'car (nth 1 args)) (mapcar 'car (nth 1 args))
(nth 1 args)) (nth 1 args))
(cddr args))) (cddr args)))))
(if (and org-completion-use-iswitchb
(boundp 'iswitchb-mode) iswitchb-mode
(listp (second args)))
(apply 'org-iswitchb-completing-read (concat (car args))
(if (consp (car (nth 1 args)))
(mapcar 'car (nth 1 args))
(nth 1 args))
(cddr args))
(apply 'completing-read args)))))
(defun org-extract-attributes (s) (defun org-extract-attributes (s)
"Extract the attributes cookie from a string and set as text property." "Extract the attributes cookie from a string and set as text property."