emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 9917d69543 1/2: org-indent-region: Fix when `org-ad


From: ELPA Syncer
Subject: [elpa] externals/org 9917d69543 1/2: org-indent-region: Fix when `org-adapt-indentation' is 'headline-data
Date: Tue, 19 Jul 2022 00:57:41 -0400 (EDT)

branch: externals/org
commit 9917d69543226c68ca9e749e4f53e5f3e8ec8e79
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-indent-region: Fix when `org-adapt-indentation' is 'headline-data
    
    * lisp/org.el (org--get-expected-indentation): Remove the extra
    condition added in e3b79ad2b in the cond branch for first line in an
    element.  Checking `org-adapt-indentation' t value here trigger the
    last default cond branch that assumes that we are _not_ at the first
    line.
    
    The new logic explicitly avoids inheriting indentation from previous
    sibling when `org-adapt-indentation' is set to 'headline-data and the
    previous sibling is satisfying "headline data" condition as in
    `org-indent-line'.  The case when `org-adapt-indentation' is set to t
    is already handled correctly when calculating the CONTENTSP
    indentation for parent headline.
    
    Fixes 
https://orgmode.org/list/c13cab60-bbc9-e69e-6d0d-7fe75c5908d6@kalysto.org
---
 lisp/org.el | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 99e5d0dc7c..64b148d9c7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18455,9 +18455,9 @@ ELEMENT."
        (org-element-property :parent element) t))
       ;; At first line: indent according to previous sibling, if any,
       ;; ignoring footnote definitions and inline tasks, or parent's
-      ;; contents.
-      ((and ( = (line-beginning-position) start)
-           (eq org-adapt-indentation t))
+      ;; contents.  If `org-adapt-indentation' is `headline-data', ignore
+      ;; previous headline data siblings.
+      ((= (line-beginning-position) start)
        (catch 'exit
         (while t
           (if (= (point-min) start) (throw 'exit 0)
@@ -18474,6 +18474,21 @@ ELEMENT."
                ((memq (org-element-type previous)
                       '(footnote-definition inlinetask))
                 (setq start (org-element-property :begin previous)))
+                ;; Do not indent like previous when the previous
+                ;; element is headline data and `org-adapt-indentation'
+                ;; is set to `headline-data'.
+                ((save-excursion
+                   (goto-char start)
+                   (and
+                    (eq org-adapt-indentation 'headline-data)
+                    (not (or (org-at-clock-log-p)
+                           (org-at-planning-p)))
+                    (progn
+                      (beginning-of-line 1)
+                      (skip-chars-backward "\n")
+                      (or (org-at-heading-p)
+                          (looking-back ":END:.*" (point-at-bol))))))
+                 (throw 'exit 0))
                (t (goto-char (org-element-property :begin previous))
                   (throw 'exit
                          (if (bolp) (current-indentation)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]