[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 34082ff184 2/2: org-indent-line: Fix with line is w
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 34082ff184 2/2: org-indent-line: Fix with line is within blank lines after heading |
Date: |
Sun, 11 Jun 2023 06:59:41 -0400 (EDT) |
branch: externals/org
commit 34082ff184b1ceb5ff57e9daf91a774c038dfc7a
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-indent-line: Fix with line is within blank lines after heading
* lisp/org.el (org-indent-line): Fix when we are within blank lines
after heading. ELEMENT is then `heading' and looking at :begin - 1
does not make sense.
* testing/lisp/test-org.el (test-org/indent-region): Add test.
Reported-by: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Link:
https://orgmode.org/list/d7129804-1f42-ea2b-85e8-18ea1ee32d73@vodafonemail.de
---
lisp/org.el | 13 ++++++++-----
testing/lisp/test-org.el | 7 +++++++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index d5fbc5abe2..a27e90c381 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19055,13 +19055,16 @@ Also align node properties according to
`org-property-format'."
(interactive)
(let* ((element (save-excursion (beginning-of-line)
(org-element-at-point-no-context)))
(type (org-element-type element)))
- (unless (or (org-at-heading-p)
+ (unless (or (org-at-heading-p) ; headline has no indent ever.
+ ;; Do not indent first element after headline data.
(and (eq org-adapt-indentation 'headline-data)
(not (org--at-headline-data-p nil element))
- (save-excursion
- (goto-char (1- (org-element-property :begin element)))
- (or (org-at-heading-p)
- (org--at-headline-data-p)))))
+ ;; Not at headline data and previous is headline
data/headline.
+ (or (memq type '(headline inlinetask)) ; blank lines
after heading
+ (save-excursion
+ (goto-char (1- (org-element-property :begin
element)))
+ (or (org-at-heading-p)
+ (org--at-headline-data-p))))))
(cond ((and (memq type '(plain-list item))
(= (line-beginning-position)
(org-element-property :post-affiliated element)))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 1b59c48d61..3ef5e7e5b8 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -1367,6 +1367,13 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46]
=> 0:46"
(org-test-with-temp-text "* H\nSCHEDULED: <2022-11-03>\nParagraph"
(org-indent-region (point-min) (point-max))
(buffer-string)))))
+ ;; Do not indent empty lines after heading, when no headline data.
+ (let ((org-adapt-indentation 'headline-data))
+ (should
+ (equal "* H1\n\n* H2\n"
+ (org-test-with-temp-text "* H1\n\n* H2\n<point>"
+ (org-indent-line)
+ (buffer-string)))))
(let ((org-adapt-indentation 'headline-data)
(org-log-into-drawer t))
(should