org: Fix tags extraction

* lisp/org.el (org-get-tags-at): Use non-greedy match up to colon to
  match all tags (and not just the last.)
* testing/lisp/test-org.el (test-org/tags-at): One test to cover the
  issue.
This commit is contained in:
Marco Wahl 2016-06-09 09:39:38 +02:00
parent f94df5456f
commit 7e57cf5d40
2 changed files with 8 additions and 1 deletions

View File

@ -14870,7 +14870,7 @@ ignore inherited ones."
(org-back-to-heading t)
(while (not (equal lastpos (point)))
(setq lastpos (point))
(when (looking-at ".+:\\([[:alnum:]_@#%:]+\\):[ \t]*$")
(when (looking-at ".+?:\\([[:alnum:]_@#%:]+\\):[ \t]*$")
(setq ltags (org-split-string
(match-string-no-properties 1) ":"))
(when parent

View File

@ -4509,6 +4509,13 @@ Paragraph<point>"
(org-fix-tags-on-the-fly))
(buffer-string)))))
(ert-deftest test-org/tags-at ()
(should
(equal '("foo" "bar")
(org-test-with-temp-text
"* T<point>est :foo:bar:"
(org-get-tags-at)))))
;;; Timestamps API