Also use TAB for completion with org-insert-link.

Before this patch the completion mechanism was this: TAB let's you
complete through link prefixes (gnus: file: bbdb: ...) then RET allows
completion if a completion mechanism is available for the chosen prefix.
Navigating through the history of stored links was a separate process,
available through the up/down M-n/M-p keys.

Now TAB not only completes through link prefixes but also through stored
links.  This behavior matches other Emacs completion mechanisms a bit
more closely.
This commit is contained in:
Bastien Guerry 2009-07-19 19:45:06 +02:00
parent ffa046d38b
commit e17368ca76
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,8 @@
2009-07-19 Bastien Guerry <bzg@altern.org>
* org.el (orgstruct++-mode): Fix typo in docstring.
(org-insert-link): Clean up: (or (...)) => (...)
(org-insert-link): Use TAB for stored links completion.
2009-07-18 Bastien Guerry <bzg@altern.org>

View File

@ -7370,11 +7370,13 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
(let ((org-completion-use-ido nil))
(org-completing-read
"Link: "
(mapcar (lambda (x) (list (concat x ":")))
all-prefixes)
(append
(mapcar (lambda (x) (list (concat x ":")))
all-prefixes)
(mapcar 'car org-stored-links))
nil nil nil
'tmphist
(or (car (car org-stored-links))))))
(car (car org-stored-links)))))
(if (or (member link all-prefixes)
(and (equal ":" (substring link -1))
(member (substring link 0 -1) all-prefixes)
@ -7442,7 +7444,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
(insert (org-make-link-string link desc))))
(defun org-link-try-special-completion (type)
"If there is completion support for link type TAPE, offer it."
"If there is completion support for link type TYPE, offer it."
(let ((fun (intern (concat "org-" type "-complete-link"))))
(if (functionp fun)
(funcall fun)