Fix following links starting with square brackets

* lisp/org.el (org-link-search): Improve regexp.
* testing/lisp/test-org.el (test-org/fuzzy-links): Add tests.
This commit is contained in:
Nicolas Goaziou 2016-12-26 10:29:54 +01:00
parent 820d1eb617
commit 4cf56e6e89
2 changed files with 10 additions and 5 deletions

View File

@ -11234,13 +11234,10 @@ of matched result, which is either `dedicated' or `fuzzy'."
;; statistics cookies and tags.
((and (derived-mode-p 'org-mode)
(let ((title-re
(format "%s[ \t]*\\(?:%s[ \t]+\\)?.*%s"
(format "%s.*\\(?:%s[ \t]\\)?.*%s"
org-outline-regexp-bol
org-comment-string
(mapconcat
(lambda (w) (format "\\<%s\\>" (regexp-quote w)))
words
".+")))
(mapconcat #'regexp-quote words ".+")))
(cookie-re "\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]")
(comment-re (format "\\`%s[ \t]+" org-comment-string)))
(goto-char (point-min))

View File

@ -2134,9 +2134,17 @@ Foo Bar
(org-test-with-temp-text "[[*Test]]\n* COMMENT Test"
(org-open-at-point)
(looking-at "\\* COMMENT Test")))
(should
(org-test-with-temp-text "[[*Test]]\n* TODO COMMENT Test"
(org-open-at-point)
(looking-at "\\* TODO COMMENT Test")))
;; Correctly un-hexify fuzzy links.
(should
(org-test-with-temp-text "* With space\n[[*With%20space][With space<point>]]"
(org-open-at-point)
(bobp)))
(should
(org-test-with-temp-text "* [1]\n[[*%5B1%5D<point>]]"
(org-open-at-point)
(bobp))))