From 2e8591783fa3f9cd01c485dcd5e3c056b740c23f Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 29 Oct 2012 13:52:09 +0100 Subject: [PATCH] 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. --- lisp/org-element.el | 6 +++++- testing/lisp/test-org-element.el | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index c69f518ab..4b973bee3 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 8462f766a..d6298dbd4 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.