Fix tags looking like plain links
* lisp/org-element.el (org-element-context): Do not look for objects within TODO keyword, priority cookie, comment keyword or tags. * lisp/org.el (org-activate-tags): Fix regexp. * testing/lisp/test-org-element.el (test-org-element/context): Add test. Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
This commit is contained in:
parent
671ed99d23
commit
6e57a371ff
|
@ -5773,10 +5773,14 @@ Providing it allows for quicker computation."
|
|||
;; At an headline or inlinetask, objects are in title.
|
||||
((memq type '(headline inlinetask))
|
||||
(goto-char (org-element-property :begin element))
|
||||
(skip-chars-forward "*")
|
||||
(if (and (> pos (point)) (< pos (line-end-position)))
|
||||
(narrow-to-region (point) (line-end-position))
|
||||
(throw 'objects-forbidden element)))
|
||||
(looking-at org-complex-heading-regexp)
|
||||
(let ((end (match-end 4)))
|
||||
(if (not end) (throw 'objects-forbidden element)
|
||||
(goto-char (match-beginning 4))
|
||||
(when (let (case-fold-search) (looking-at org-comment-string))
|
||||
(goto-char (match-end 0)))
|
||||
(if (>= (point) end) (throw 'objects-forbidden element)
|
||||
(narrow-to-region (point) end)))))
|
||||
;; At a paragraph, a table-row or a verse block, objects are
|
||||
;; located within their contents.
|
||||
((memq type '(paragraph table-row verse-block))
|
||||
|
|
16
lisp/org.el
16
lisp/org.el
|
@ -6240,14 +6240,14 @@ done, nil otherwise."
|
|||
(font-lock-mode 1)))
|
||||
|
||||
(defun org-activate-tags (limit)
|
||||
(if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \r\n]") limit t)
|
||||
(progn
|
||||
(org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1))
|
||||
(add-text-properties (match-beginning 1) (match-end 1)
|
||||
(list 'mouse-face 'highlight
|
||||
'keymap org-mouse-map))
|
||||
(org-rear-nonsticky-at (match-end 1))
|
||||
t)))
|
||||
(when (re-search-forward
|
||||
(org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$") limit t)
|
||||
(org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1))
|
||||
(add-text-properties (match-beginning 1) (match-end 1)
|
||||
(list 'mouse-face 'highlight
|
||||
'keymap org-mouse-map))
|
||||
(org-rear-nonsticky-at (match-end 1))
|
||||
t))
|
||||
|
||||
(defun org-outline-level ()
|
||||
"Compute the outline level of the heading at point.
|
||||
|
|
|
@ -3422,6 +3422,15 @@ Text
|
|||
(should
|
||||
(eq 'link
|
||||
(org-test-with-temp-text "[fn::[[<point>http://orgmode.org]]]"
|
||||
(org-element-type (org-element-context)))))
|
||||
;; Special case: tags looking like a link.
|
||||
(should-not
|
||||
(eq 'link
|
||||
(org-test-with-temp-text "* Headline :file<point>:tags:"
|
||||
(org-element-type (org-element-context)))))
|
||||
(should
|
||||
(eq 'link
|
||||
(org-test-with-temp-text "* Headline :file<point>:tags: :real:tag:"
|
||||
(org-element-type (org-element-context))))))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue