From 707d52cff703e8bb11dbb87072192d292a45aeb5 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 2 Apr 2015 10:29:36 +0200 Subject: [PATCH] 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. --- lisp/org.el | 8 ++++---- testing/lisp/test-org.el | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index ff803dd71..46fb2ab8a 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -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: diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index d366c9b70..543a49094 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -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