diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2012-08-12 00:48:09 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2012-08-12 00:48:09 +0200 |
commit | 8fc893a0369d0171ab9f4ba033984ff0377def5e (patch) | |
tree | 1e43a7aef7fa382ff40d55342af42611c4dae617 | |
parent | 8ff6054c855934e2edc1f6b7015c48e57f0baabc (diff) | |
download | org-mode-8fc893a0369d0171ab9f4ba033984ff0377def5e.tar.gz |
org-element: Fix small bug
* lisp/org-element.el (org-element-at-point): Return consistent value
when function is called on a blank line within a plain list.
* testing/lisp/test-org-element.el: Add test.
-rw-r--r-- | lisp/org-element.el | 5 | ||||
-rw-r--r-- | testing/lisp/test-org-element.el | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el index 080863a..57e5235 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4116,8 +4116,9 @@ first element of current section." ;; return that element instead. (and (= cend origin) (memq type - '(center-block drawer dynamic-block inlinetask - quote-block special-block)))) + '(center-block + drawer dynamic-block inlinetask item + plain-list quote-block special-block)))) (throw 'exit (if keep-trail trail element)) (setq parent element) (case type diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 81b2213..6c2b39f 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -2270,6 +2270,22 @@ Paragraph \\alpha." (org-test-with-temp-text "#+BEGIN_CENTER\nParagraph\n#+END_CENTER" (progn (forward-line 2) (org-element-type (org-element-at-point)))))) + ;; Special case: at a blank line between two items, be sure to + ;; return item above instead of the last element of its contents. + (should + (eq 'item + (org-test-with-temp-text "- Para1\n\n- Para2" + (progn (forward-line) + (org-element-type + (let ((org-empty-line-terminates-plain-lists nil)) + (org-element-at-point))))))) + ;; Special case: at the last blank line in a plain list, return it + ;; instead of the last item. + (should + (eq 'plain-list + (org-test-with-temp-text "- Para1\n- Para2\n\nPara3" + (progn (forward-line 2) + (org-element-type (org-element-at-point)))))) ;; With an optional argument, return trail. (should (equal '(paragraph center-block) |