summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-06-25 15:32:26 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2013-06-25 15:37:48 (GMT)
commit838e849bf785bef78fb44c50c9bc4bf86f3cb579 (patch)
treed36cae0377fffc42d49020e2e1ea89506985c43d
parent95b16b1aa544f724d716e6d16e722f9f1473f864 (diff)
downloadorg-mode-838e849bf785bef78fb44c50c9bc4bf86f3cb579.zip
org-mode-838e849bf785bef78fb44c50c9bc4bf86f3cb579.tar.gz
org-element: Fix org-meta-return error at the end of buffer
* lisp/org-element.el (org-element--current-element): Fix org-meta-return error at the end of buffer. * testing/lisp/test-org-element.el: Add test. Thanks to Nicolas Richard for reporting this.
-rw-r--r--lisp/org-element.el2
-rw-r--r--testing/lisp/test-org-element.el7
2 files changed, 7 insertions, 2 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 8f484eb..23ded78 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -3817,7 +3817,7 @@ element it has to parse."
(cond
;; Jumping over affiliated keywords put point off-limits.
;; Parse them as regular keywords.
- ((>= (point) limit)
+ ((and (cdr affiliated) (>= (point) limit))
(goto-char (car affiliated))
(org-element-keyword-parser limit nil))
;; LaTeX Environment.
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index e57d8e0..bdba611 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -2848,7 +2848,12 @@ Paragraph \\alpha."
"- outer\n #+begin_center\n - inner\n #+end_center"
(search-forward "inner")
(beginning-of-line)
- (org-element-type (org-element-at-point))))))
+ (org-element-type (org-element-at-point)))))
+ ;; Do not error at eob on an empty line.
+ (should
+ (org-test-with-temp-text "* H\n"
+ (forward-line)
+ (or (org-element-at-point) t))))
(ert-deftest test-org-element/context ()
"Test `org-element-context' specifications."