org-element: Fix org-element-context on parsed keywords

* lisp/org-element.el (org-element-context): Fix org-element-context
  on parsed keywords.
* testing/lisp/test-org-element.el: Update test.
This commit is contained in:
Nicolas Goaziou 2012-10-29 13:52:09 +01:00
parent a2120a9d73
commit 2e8591783f
2 changed files with 6 additions and 2 deletions

View File

@ -4629,6 +4629,10 @@ and :post-blank properties."
(looking-at org-element--affiliated-re)
(member (upcase (match-string 1))
org-element-parsed-keywords))
;; We're at an affiliated keyword. Change
;; type to retrieve correct restrictions.
(setq type 'keyword)
;; Determine if we're at main or dual value.
(if (and (match-end 2) (<= origin (match-end 2)))
(progn (goto-char (match-beginning 2))
(setq end (match-end 2)))
@ -4667,7 +4671,7 @@ and :post-blank properties."
(forward-char)
(setq end (line-end-position))))))))
element
(let ((restriction (org-element-restriction element))
(let ((restriction (org-element-restriction type))
(parent element)
candidates)
(catch 'exit

View File

@ -2654,7 +2654,7 @@ Paragraph \\alpha."
;; Find objects in parsed affiliated keywords.
(should
(eq 'macro
(org-test-with-temp-text "#+CAPTION: {{{macro}}}\nParagraph."
(org-test-with-temp-text "#+CAPTION: {{{macro}}}\n| a | b |."
(progn (search-forward "{")
(org-element-type (org-element-context))))))
;; Correctly set `:parent' property.