org.el (org-insert-link): Fix bug when inserting links to headlines containing the ">" character

* org.el (org-insert-link): Fix bug when inserting links to
headlines containing the ">" character.

Thanks to William Léchelle for reporting this.
This commit is contained in:
Bastien Guerry 2012-12-28 11:03:58 +01:00
parent 6671e80453
commit de6201b19c
1 changed files with 4 additions and 3 deletions

View File

@ -9317,10 +9317,11 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
;; URL-like link, normalize the use of angular brackets.
(setq link (org-remove-angle-brackets link)))
;; Check if we are linking to the current file with a search option
;; If yes, simplify the link by using only the search option.
;; Check if we are linking to the current file with a search
;; option If yes, simplify the link by using only the search
;; option.
(when (and buffer-file-name
(string-match "^file:\\(.+?\\)::\\([^>]+\\)" link))
(string-match "^file:\\(.+?\\)::\\(.+\\)" link))
(let* ((path (match-string 1 link))
(case-fold-search nil)
(search (match-string 2 link)))