summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-10-05 13:08:58 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2012-10-05 13:08:58 (GMT)
commit78d2bd7edcc28e2f5bd5bcde5f8d47ab09f2f0ed (patch)
tree7bee07581d8690ddef7eb4c50928842d3b1ee680
parente5e49ea327c17ea5be9a49558d2f5face5b93797 (diff)
parentdaf8cf030c21260b2615c303653913cdf2907e00 (diff)
downloadorg-mode-78d2bd7edcc28e2f5bd5bcde5f8d47ab09f2f0ed.zip
org-mode-78d2bd7edcc28e2f5bd5bcde5f8d47ab09f2f0ed.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-element.el11
-rw-r--r--testing/lisp/test-org-element.el11
2 files changed, 19 insertions, 3 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 64a9e4a..7f17579 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -3958,6 +3958,9 @@ Return value is an alist whose CAR is position and CDR the object
type, as a symbol.
OBJECTS is the previous candidates alist."
+ ;; Filter out any object found but not belonging to RESTRICTION.
+ (setq objects (org-remove-if-not (lambda (obj) (memq (car obj) restriction))
+ objects))
(let (next-candidates types-to-search)
;; If no previous result, search every object type in RESTRICTION.
;; Otherwise, keep potential candidates (old objects located after
@@ -4357,7 +4360,7 @@ and :post-blank properties."
(progn (beginning-of-line)
(skip-chars-forward "* ")
(setq end (point-at-eol))))
- (and (memq type '(paragraph table-cell verse-block))
+ (and (memq type '(paragraph table-row verse-block))
(let ((cbeg (org-element-property
:contents-begin element))
(cend (org-element-property
@@ -4376,7 +4379,7 @@ and :post-blank properties."
candidates)))
;; If ORIGIN is before next object in element, there's
;; no point in looking further.
- (if (> (cdr closest-cand) origin) (throw 'exit element)
+ (if (> (cdr closest-cand) origin) (throw 'exit parent)
(let* ((object
(progn (goto-char (cdr closest-cand))
(funcall (intern (format "org-element-%s-parser"
@@ -4396,7 +4399,9 @@ and :post-blank properties."
;; search to the end of its contents.
(t (goto-char cbeg)
(org-element-put-property object :parent parent)
- (setq parent object end cend)))))))
+ (setq parent object
+ restriction (org-element-restriction object)
+ end cend)))))))
parent))))))
(defsubst org-element-nested-p (elem-A elem-B)
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 887d65a..e0f6636 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -2512,6 +2512,17 @@ Paragraph \\alpha."
(org-test-with-temp-text "* Headline _with_ underlining"
(progn (search-forward "w")
(org-element-type (org-element-context))))))
+ ;; Find objects in objects.
+ (should
+ (eq 'macro
+ (org-test-with-temp-text "| a | {{{macro}}} |"
+ (progn (search-forward "{")
+ (org-element-type (org-element-context))))))
+ (should
+ (eq 'table-cell
+ (org-test-with-temp-text "| a | b {{{macro}}} |"
+ (progn (search-forward "b")
+ (org-element-type (org-element-context))))))
;; Correctly set `:parent' property.
(should
(eq 'paragraph