forked from mirrors/org-mode
org-insert-link: Use ido when inserting links
org.el (org-insert-link): Remove a list within the list of link creation that causes a bug when using ido. Remove the hard coded iswitch and ido switches. (org-iread-file-name): Create a function that can use ido-read-file-name if flagged as ok. (org-file-complete-link): Reference org-iread-file-name.
This commit is contained in:
parent
56470de26d
commit
7f096ad379
36
lisp/org.el
36
lisp/org.el
|
@ -9317,18 +9317,15 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(progn
|
(progn
|
||||||
(setq link
|
(setq link
|
||||||
(let ((org-completion-use-ido nil)
|
(org-completing-read
|
||||||
(org-completion-use-iswitchb nil))
|
"Link: "
|
||||||
(org-completing-read
|
(append
|
||||||
"Link: "
|
(mapcar (lambda (x) (concat x ":"))
|
||||||
(append
|
all-prefixes)
|
||||||
(mapcar (lambda (x) (list (concat x ":")))
|
(mapcar 'car org-stored-links))
|
||||||
all-prefixes)
|
nil nil nil
|
||||||
(mapcar 'car org-stored-links)
|
'tmphist
|
||||||
(mapcar 'cadr org-stored-links))
|
(caar org-stored-links)))
|
||||||
nil nil nil
|
|
||||||
'tmphist
|
|
||||||
(caar org-stored-links))))
|
|
||||||
(if (not (string-match "\\S-" link))
|
(if (not (string-match "\\S-" link))
|
||||||
(error "No link selected"))
|
(error "No link selected"))
|
||||||
(mapc (lambda(l)
|
(mapc (lambda(l)
|
||||||
|
@ -9422,7 +9419,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
|
||||||
(defun org-file-complete-link (&optional arg)
|
(defun org-file-complete-link (&optional arg)
|
||||||
"Create a file link using completion."
|
"Create a file link using completion."
|
||||||
(let (file link)
|
(let (file link)
|
||||||
(setq file (read-file-name "File: "))
|
(setq file (org-iread-file-name "File: "))
|
||||||
(let ((pwd (file-name-as-directory (expand-file-name ".")))
|
(let ((pwd (file-name-as-directory (expand-file-name ".")))
|
||||||
(pwd1 (file-name-as-directory (abbreviate-file-name
|
(pwd1 (file-name-as-directory (abbreviate-file-name
|
||||||
(expand-file-name ".")))))
|
(expand-file-name ".")))))
|
||||||
|
@ -9440,6 +9437,19 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
|
||||||
(t (setq link (concat "file:" file)))))
|
(t (setq link (concat "file:" file)))))
|
||||||
link))
|
link))
|
||||||
|
|
||||||
|
(defun org-iread-file-name (&rest args)
|
||||||
|
"Read-file-name using `ido-mode' speedup if available.
|
||||||
|
ARGS are arguments that may be passed to `ido-read-file-name' or `read-file-name'.
|
||||||
|
See `read-file-name' for a description of parameters."
|
||||||
|
(org-without-partial-completion
|
||||||
|
(if (and org-completion-use-ido
|
||||||
|
(fboundp 'ido-read-file-name)
|
||||||
|
(boundp 'ido-mode) ido-mode
|
||||||
|
(listp (second args)))
|
||||||
|
(let ((ido-enter-matching-directory nil))
|
||||||
|
(apply 'ido-read-file-name args))
|
||||||
|
(apply 'read-file-name args))))
|
||||||
|
|
||||||
(defun org-completing-read (&rest args)
|
(defun org-completing-read (&rest args)
|
||||||
"Completing-read with SPACE being a normal character."
|
"Completing-read with SPACE being a normal character."
|
||||||
(let ((enable-recursive-minibuffers t)
|
(let ((enable-recursive-minibuffers t)
|
||||||
|
|
Loading…
Reference in a new issue