summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-10-06 19:35:25 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-10-06 19:35:25 +0200
commit44e3745c786cd2994c0ce930a28c6863dfd5af7b (patch)
tree7edcaa5e63df507d84c2753f12a66fec3918a3c5
parent9455c6910e513f84a318c292cdc7f4146d47119c (diff)
parentfb403ca34ee87118683d4f5a64f0caac0168d95c (diff)
downloadorg-mode-44e3745c786cd2994c0ce930a28c6863dfd5af7b.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org.el12
-rw-r--r--testing/lisp/test-org.el5
2 files changed, 11 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 9d48ecb..5a60e34 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -24221,10 +24221,11 @@ convenience:
(backward-char)
(org-backward-paragraph))
((<= (point) post-affiliated) (goto-char begin))
+ ;; Special behavior: on a table or a property drawer, move to
+ ;; its beginning.
((memq type '(node-property table-row))
(goto-char (org-element-property
:post-affiliated (org-element-property :parent element))))
- ((memq type '(property-drawer table)) (goto-char begin))
(special?
(if (<= (point) contents-begin) (goto-char post-affiliated)
;; Inside a verse block, see blank lines as paragraph
@@ -24235,8 +24236,7 @@ convenience:
(skip-chars-forward " \r\t\n" origin)
(if (= (point) origin) (goto-char contents-begin)
(beginning-of-line))))))
- ((eq type 'paragraph)
- (goto-char contents-begin)
+ ((eq type 'paragraph) (goto-char contents-begin)
;; When at first paragraph in an item or a footnote definition,
;; move directly to beginning of line.
(let ((parent-contents
@@ -24244,9 +24244,9 @@ convenience:
:contents-begin (org-element-property :parent element))))
(when (and parent-contents (= parent-contents contents-begin))
(beginning-of-line))))
- ;; At the end of a greater element, move to the beginning of the
- ;; last element within.
- ((>= (point) contents-end)
+ ;; At the end of a greater element, move to the beginning of
+ ;; the last element within.
+ ((and contents-end (>= (point) contents-end))
(goto-char (1- contents-end))
(org-backward-paragraph))
(t (goto-char (or post-affiliated begin))))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 673e3fa..a185cff 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -3607,6 +3607,11 @@ SCHEDULED: <2017-05-06 Sat>
(should
(org-test-with-temp-text "#+BEGIN_<point>EXAMPLE\nL1\n#+END_EXAMPLE"
(org-backward-paragraph)
+ (bobp)))
+ ;; Pathological case: on an empty heading, move to its beginning.
+ (should
+ (org-test-with-temp-text "* <point>H"
+ (org-backward-paragraph)
(bobp))))
(ert-deftest test-org/forward-element ()