all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
Cc: Uwe Brauer <oub@mat.ucm.es>, emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87fssqtzgk.fsf@localhost> (raw)
In-Reply-To: <87pmrupu0s.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-get-expected-indentation-Consider-section-parent.patch --]
[-- Type: text/x-diff, Size: 1984 bytes --]

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 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


  reply	other threads:[~2021-10-24 11:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-23  6:42 [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 11:00 ` Kévin Le Gouguec
2021-10-24 11:49   ` Ihor Radchenko [this message]
2021-10-24 12:56     ` [PATCH] " Kévin Le Gouguec
2021-10-24 15:30       ` Uwe Brauer
2021-10-24 19:22         ` Kévin Le Gouguec
2021-10-25  2:53           ` Ihor Radchenko
2021-10-25  9:47           ` Uwe Brauer
2021-10-25 14:15         ` Ihor Radchenko
2021-10-24 14:48   ` Uwe Brauer
2021-10-25 10:11     ` Eric S Fraga
2021-10-25 10:13       ` Uwe Brauer
2021-10-25 11:16         ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fssqtzgk.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kevin.legouguec@gmail.com \
    --cc=oub@mat.ucm.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.