summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-11-23 23:49:19 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2012-11-23 23:49:19 +0100
commitce8819f18d9d2be000fb70fc4d74b5d96fe07a83 (patch)
treef70a064cddb30d637dcb9ac01874d0b116d39821
parentf71df7dc508020b60697c1c31144f31fc27ce4f2 (diff)
parent89b8a8ca6daa3ccafa818a7085620eeee1ab9752 (diff)
downloadorg-mode-ce8819f18d9d2be000fb70fc4d74b5d96fe07a83.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-element.el18
-rw-r--r--testing/lisp/test-org-element.el9
2 files changed, 19 insertions, 8 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 9ac4488..4c61af6 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -4676,18 +4676,22 @@ and :post-blank properties."
(funcall (intern (format "org-element-%s-parser"
(car closest-cand))))))
(cbeg (org-element-property :contents-begin object))
- (cend (org-element-property :contents-end object)))
+ (cend (org-element-property :contents-end object))
+ (obj-end (org-element-property :end object)))
(cond
;; ORIGIN is after OBJECT, so skip it.
- ((< (org-element-property :end object) origin)
- (goto-char (org-element-property :end object)))
- ;; ORIGIN is within a non-recursive object or at an
- ;; object boundaries: Return that object.
+ ((<= obj-end origin)
+ (if (/= obj-end end) (goto-char obj-end)
+ (throw 'exit
+ (org-element-put-property
+ object :parent parent))))
+ ;; ORIGIN is within a non-recursive object or at
+ ;; an object boundaries: Return that object.
((or (not cbeg) (> cbeg origin) (< cend origin))
(throw 'exit
(org-element-put-property object :parent parent)))
- ;; Otherwise, move within current object and restrict
- ;; search to the end of its contents.
+ ;; Otherwise, move within current object and
+ ;; restrict search to the end of its contents.
(t (goto-char cbeg)
(org-element-put-property object :parent parent)
(setq parent object
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index d19ce2a..6069260 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -2677,7 +2677,14 @@ Paragraph \\alpha."
(org-test-with-temp-text "Some *bold* text"
(progn (search-forward "bold")
(org-element-type
- (org-element-property :parent (org-element-context))))))))
+ (org-element-property :parent (org-element-context)))))))
+ ;; Between two objects, return the second one.
+ (should
+ (eq 'macro
+ (org-test-with-temp-text "<<target>>{{{test}}}"
+ (progn (search-forward "{")
+ (backward-char)
+ (org-element-type (org-element-context)))))))
(provide 'test-org-element)