Fix `org-olpath-completing-read'

* lisp/org.el (org-olpath-completing-read): Feed
  `org-icompleting-read' with COLLECTION argument too.
This commit is contained in:
Nicolas Goaziou 2015-06-01 18:20:46 +02:00
parent 458bde5243
commit 1a73641770

View file

@ -12124,31 +12124,26 @@ this is used for the GOTO interface."
(let ((thetable collection) (let ((thetable collection)
(org-completion-use-ido nil) ; does not work with ido. (org-completion-use-ido nil) ; does not work with ido.
(org-completion-use-iswitchb nil)) ; or iswitchb (org-completion-use-iswitchb nil)) ; or iswitchb
(apply (apply #'org-icompleting-read
'org-icompleting-read prompt prompt
(lambda (string predicate &optional flag) collection
(let (rtn r f (l (length string))) (lambda (string predicate &optional flag)
(cond (cond
((eq flag nil) ((eq flag nil) (try-completion string thetable))
;; try completion ((eq flag t)
(try-completion string thetable)) (let ((l (length string)))
((eq flag t) (mapcar (lambda (x)
;; all-completions (let ((r (substring x l))
(setq rtn (all-completions string thetable predicate)) (f (if (string-match " ([^)]*)$" x)
(mapcar (match-string 0 x)
(lambda (x) "")))
(setq r (substring x l)) (if (string-match "/" r)
(if (string-match " ([^)]*)$" x) (concat string (substring r 0 (match-end 0)) f)
(setq f (match-string 0 x)) x)))
(setq f "")) (all-completions string thetable predicate))))
(if (string-match "/" r) ;; Exact match?
(concat string (substring r 0 (match-end 0)) f) ((eq flag 'lambda) (assoc string thetable))))
x)) args)))
rtn))
((eq flag 'lambda)
;; exact match?
(assoc string thetable)))))
args)))
;;;; Dynamic blocks ;;;; Dynamic blocks