[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-14
From: |
Ihor Radchenko |
Subject: |
[PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)] |
Date: |
Sun, 24 Oct 2021 19:49:15 +0800 |
Kévin Le Gouguec <kevin.legouguec@gmail.com> writes:
> fc80d052d was a rather chunky commit so I did not dig into the patch;
> Ihor, does it make sense to you that it might have introduced
> unfortunate side-effects wrt :PROPERTIES: indentation?
You are right. org--get-expected-indentation have some expectations
about :parent property of provided ELEMENT. After my commit, elements
can have sections as parents. The tentative fix is attached, but please
double check because I am not very familiar with the indentation code.
Best,
Ihor
>From 5f4fd0880a47baa062adc669dd71b5c3bb917081 Mon Sep 17 00:00:00 2001
Message-Id:
<5f4fd0880a47baa062adc669dd71b5c3bb917081.1635075984.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Sun, 24 Oct 2021 19:25:24 +0800
Subject: [PATCH] org--get-expected-indentation: Consider section parent type
* lisp/org.el (org--get-expected-indentation): Consider new :parent
structure when `org-element-at-point' returns parent section and
headline elements.
* testing/lisp/test-org.el (test-org/indent-region): Add test.
Fixes 87pmrupu0s.fsf@gmail.com/T/#t">https://list.orgmode.org/87pmrupu0s.fsf@gmail.com/T/#t
---
lisp/org.el | 4 ++++
testing/lisp/test-org.el | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/lisp/org.el b/lisp/org.el
index 0a83c00fc..90804d26e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19218,6 +19218,10 @@ (defun org--get-expected-indentation (element
contentsp)
(contentsp
(cl-case type
((diary-sexp footnote-definition) 0)
+ (section
+ (org--get-expected-indentation
+ (org-element-property :parent element)
+ t))
((headline inlinetask nil)
(if (not org-adapt-indentation) 0
(let ((level (org-current-level)))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 47a5f565f..5838b192d 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -1168,6 +1168,13 @@ (ert-deftest test-org/indent-region ()
(org-adapt-indentation nil))
(org-indent-region (point) (point-max)))
(buffer-string))))
+ ;; Indent property drawers according to `org-adapt-indentation'.
+ (let ((org-adapt-indentation 'headline-data))
+ (should
+ (equal "* H\n :PROPERTIES:\n :key:\n :END:"
+ (org-test-with-temp-text "* H\n:PROPERTIES:\n:key:\n:END:"
+ (org-indent-region (point-min) (point-max))
+ (buffer-string)))))
;; Indent plain lists.
(let ((org-adapt-indentation t))
(should
--
2.32.0
- [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)], Uwe Brauer, 2021/10/23
- Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)], Kévin Le Gouguec, 2021/10/24
- [PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)],
Ihor Radchenko <=
- Re: [PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)], Kévin Le Gouguec, 2021/10/24
- Re: [PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)], Uwe Brauer, 2021/10/24
- Re: [PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)], Kévin Le Gouguec, 2021/10/24
- Re: [PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)], Ihor Radchenko, 2021/10/24
- Re: [PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)], Uwe Brauer, 2021/10/25
- Re: [PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)], Ihor Radchenko, 2021/10/25
Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)], Uwe Brauer, 2021/10/24