summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-02-24 20:58:55 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-02-24 20:58:55 +0100
commit41d005822ebfd1c8b65e4ae3bb3d51aea7ef47f3 (patch)
treed7f51fa983aa4762c1afe4db2ae25f78e39a226a
parent1f84cc2182720a2395dab81e152ebba273a3655f (diff)
downloadorg-mode-41d005822ebfd1c8b65e4ae3bb3d51aea7ef47f3.tar.gz
Fix indentation bug
* lisp/org.el (org--get-expected-indentation): Fix indentation bug. * testing/lisp/test-org.el (test-org/indent-line): Add test. In the following document, the last line would be indented to "|" - item #+BEGIN_SRC emacs-lisp (+ 1 1) #+END_SRC |
-rw-r--r--lisp/org.el6
-rw-r--r--testing/lisp/test-org.el15
2 files changed, 10 insertions, 11 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 8847a6c..1598626 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -22860,11 +22860,7 @@ ELEMENT."
(let ((cend (org-element-property :contents-end element)))
(and cend (<= cend pos))))
(if (memq type '(footnote-definition item plain-list))
- (let ((last (org-element-at-point)))
- (org--get-expected-indentation
- last
- (memq (org-element-type last)
- '(footnote-definition item plain-list))))
+ (org--get-expected-indentation (org-element-at-point) t)
(goto-char start)
(org-get-indentation)))
;; In any other case, indent like the current line.
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 7ca55b6..89afed6 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -718,20 +718,23 @@
;; whole list.
(should
(= 4
- (org-test-with-temp-text "* H\n- A\n - AA\n"
- (goto-char (point-max))
+ (org-test-with-temp-text "* H\n- A\n - AA\n<point>"
(let ((org-adapt-indentation t)) (org-indent-line))
(org-get-indentation))))
(should
(zerop
- (org-test-with-temp-text "* H\n- A\n - AA\n\n\n\n"
- (goto-char (point-max))
+ (org-test-with-temp-text "* H\n- A\n - AA\n\n\n\n<point>"
(let ((org-adapt-indentation t)) (org-indent-line))
(org-get-indentation))))
(should
(= 4
- (org-test-with-temp-text "* H\n- A\n - \n"
- (goto-char (point-max))
+ (org-test-with-temp-text "* H\n- A\n - \n<point>"
+ (let ((org-adapt-indentation t)) (org-indent-line))
+ (org-get-indentation))))
+ (should
+ (= 4
+ (org-test-with-temp-text
+ "* H\n - \n #+BEGIN_SRC emacs-lisp\n t\n #+END_SRC\n<point>"
(let ((org-adapt-indentation t)) (org-indent-line))
(org-get-indentation))))
;; Likewise, on a blank line at the end of a footnote definition,