summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-10-29 13:52:09 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2012-10-29 14:01:49 +0100
commit2e8591783fa3f9cd01c485dcd5e3c056b740c23f (patch)
tree88e0e19a3b51db92def940cef2225aa98ee6e0ec
parenta2120a9d7325a86f8ef459d2c4d7e3327e5a365d (diff)
downloadorg-mode-2e8591783fa3f9cd01c485dcd5e3c056b740c23f.tar.gz
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.
-rw-r--r--lisp/org-element.el6
-rw-r--r--testing/lisp/test-org-element.el2
2 files changed, 6 insertions, 2 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index c69f518..4b973be 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -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
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 8462f76..d6298db 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -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.