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 writes: "KLG" == Kévin Le Gouguec writes: > >> Ihor Radchenko writes: >>> The tentative fix is attached, but please >>> double check because I am not very familiar with the indentation code. > >> I've applied your fix on top of 281a0e26b; AFAICT it works as expected. > > I applied the patch on top of e2fa3c4c4046b6, and it worked... I applied the patch as 5f4fd0880 to main. Best, Ihor
Re: [PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)]
>>> "KLG" == Kévin Le Gouguec writes: > Uwe Brauer writes: > "KLG" == Kévin Le Gouguec writes: >> >>> I've applied your fix on top of 281a0e26b; AFAICT it works as expected. >> >> I applied the patch on top of e2fa3c4c4046b6, > (Me too actually; 281a0e26b is the commit ID I got by applying Ihor's > patch; apologies for the confusion) Aha, well when I did that I obtained 5a3bb0df92717 smime.p7s Description: S/MIME cryptographic signature
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 writes: > Mmm, starting from emacs -Q and running M-x org-indent-mode, I see Org > indent the :PROPERTIES: drawers in both files, both with the tip of > Org's 'main' branch (e2fa3c4) and with Ihor's patch applied. Same on my side. org-indent-mode works fine for me. Best, Ihor
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 writes: "KLG" == Kévin Le Gouguec writes: > >> I've applied your fix on top of 281a0e26b; AFAICT it works as expected. > > I applied the patch on top of e2fa3c4c4046b6, (Me too actually; 281a0e26b is the commit ID I got by applying Ihor's patch; apologies for the confusion) > the two examples you sent uwe1.org and uwe2.org do not indent the > drawer with org-indent-mode turned on Mmm, starting from emacs -Q and running M-x org-indent-mode, I see Org indent the :PROPERTIES: drawers in both files, both with the tip of Org's 'main' branch (e2fa3c4) and with Ihor's patch applied.
Re: [PATCH] Re: [BUG] indention of drawer does not work [9.5 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)]
>>> "KLG" == Kévin Le Gouguec writes: > Ihor Radchenko writes: >> The tentative fix is attached, but please >> double check because I am not very familiar with the indentation code. > I've applied your fix on top of 281a0e26b; AFAICT it works as expected. I applied the patch on top of e2fa3c4c4046b6, and it worked, Kevin, the two examples you sent uwe1.org and uwe2.org do not indent the drawer with org-indent-mode turned on, only with M-: (setq org-adapt-indentation 'headline-data) C-x h M-: (indent-for-tab-command) It indents. Can you confirm this? Thanks smime.p7s Description: S/MIME cryptographic signature
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 writes: >The tentative fix is attached, but please > double check because I am not very familiar with the indentation code. I've applied your fix on top of 281a0e26b; AFAICT it works as expected. Thanks for cooking up a test case! 'make check' succeeds over here, so either this patch is The Right Thing, or we'll have an opportunity to add more tests soon enough
[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 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.yanta...@gmail.com> From: Ihor Radchenko 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 https://list.orgmode.org/87pmrupu0s@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