Fix diary sexp indentation

* lisp/org.el (org--get-expected-indentation): Diary sexps are to be
  indented at column 0.
* testing/lisp/test-org.el (test-org/indent-line): Add test.
This commit is contained in:
Nicolas Goaziou 2015-04-02 10:29:36 +02:00
parent ca08453cc9
commit 707d52cff7
2 changed files with 11 additions and 6 deletions

View File

@ -22752,7 +22752,7 @@ ELEMENT."
(cond
(contentsp
(case type
(footnote-definition 0)
((diary-sexp footnote-definition) 0)
((headline inlinetask nil)
(if (not org-adapt-indentation) 0
(let ((level (org-current-level)))
@ -22771,7 +22771,7 @@ ELEMENT."
(if (save-excursion (beginning-of-line) (looking-at "[ \t]*$"))
(org--get-expected-indentation element t)
0))
((eq type 'footnote-definition) 0)
((memq type '(diary-sexp footnote-definition)) 0)
;; First paragraph of a footnote definition or an item.
;; Indent like parent.
((< (line-beginning-position) start)
@ -22858,8 +22858,8 @@ Alignment is done according to `org-property-format', which see."
Indentation is done according to the following rules:
- Footnote definitions, headlines and inline tasks have to
start at column 0.
- Footnote definitions, diary sexps, headlines and inline tasks
have to start at column 0.
- On the very first line of an element, consider, in order, the
next rules until one matches:

View File

@ -578,10 +578,10 @@
(ert-deftest test-org/indent-line ()
"Test `org-indent-line' specifications."
;; Do not indent footnote definitions or headlines.
;; Do not indent diary sexps, footnote definitions or headlines.
(should
(zerop
(org-test-with-temp-text "* H"
(org-test-with-temp-text "%%(org-calendar-holiday)"
(org-indent-line)
(org-get-indentation))))
(should
@ -589,6 +589,11 @@
(org-test-with-temp-text "[fn:1] fn"
(let ((org-adapt-indentation t)) (org-indent-line))
(org-get-indentation))))
(should
(zerop
(org-test-with-temp-text "* H"
(org-indent-line)
(org-get-indentation))))
;; Do not indent before first headline.
(should
(zerop