From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp0 ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms0.migadu.com with LMTPS
	id EMKsIS5IdWGxQwAAgWs5BA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 24 Oct 2021 13:49:02 +0200
Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp0 with LMTPS
	id wK9oHS5IdWFcLgAA1q6Kng
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 24 Oct 2021 11:49:02 +0000
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id D3E8B27157
	for <larch@yhetil.org>; Sun, 24 Oct 2021 13:49:01 +0200 (CEST)
Received: from localhost ([::1]:34606 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	id 1mebzp-0003hY-1R
	for larch@yhetil.org; Sun, 24 Oct 2021 07:49:01 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35320)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@gmail.com>)
 id 1mebyk-0003hM-GC
 for emacs-orgmode@gnu.org; Sun, 24 Oct 2021 07:47:55 -0400
Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:44997)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <yantar92@gmail.com>)
 id 1mebyi-000482-IW
 for emacs-orgmode@gnu.org; Sun, 24 Oct 2021 07:47:54 -0400
Received: by mail-pf1-x430.google.com with SMTP id v8so8013539pfu.11
 for <emacs-orgmode@gnu.org>; Sun, 24 Oct 2021 04:47:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=X05YAiylEPT8cnkXQu4Bg5EfN3C3Mcbic6jfJfIEnfA=;
 b=hvmLdhNBAC2vGanbWusklrMvQOQbD8YCGnAx1BVDxCIYOlii/MQ0vtxw6QHjqhiDB/
 osGuc5F1eczBzprdFCItGmeunvYEpIRDWR0cVWXjC0bN/KEROdAtU/wyGOuG+9kUIJ+/
 pBV1vMlc5RdmfylJ6NgTrEfwfxAnY8fce4cCA6ooNGxbooHFmWMbX1sJLgpltzBQEwLK
 NJGmCZzPTZHvVO3F75hsekhaazTkdYim8+Nqi8n1ldJFuy857jfcQ4zUmLNC4/vo9iwR
 MMZ1tXpSntnnD00nUjclCOSwFMW0/stNR7TssMzopQjeHUjXCigPRirkfKnbE4CpeoYB
 ehog==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=X05YAiylEPT8cnkXQu4Bg5EfN3C3Mcbic6jfJfIEnfA=;
 b=FYOL8YP1aTf4MnKkumLsKQp9DIPlOhf+ip0PNYIUHjkpT656isvXY+7SFTfU02Bwmy
 kRwLx3Hix+BxOsTyLd2T531CIMO3DIM0wXtLtqWqu4VR3DGBGig8UxGq7vWwZLNuc/K9
 2jmd+wSGehlM8gDEWpbngrEWi/zq6l1Vh6an6uBgk6yJyqWlfRUKlOMkmG9QQw8j2cjO
 QXu0G514tKnFUclSkyMejGavjWWvE8mZfKUbeHk0371YuyC2sNgbNZYaoCwR1rUWVtQ0
 E+/pmF51lzNsK8KKsdCvWjZQRzeXs9bYJw9sCCxSbMJVRY7UcstHjo3f9q4ILuLrmZmB
 Dlbg==
X-Gm-Message-State: AOAM5334uLAghL8V3lP8vR5e0jc/mEoYj4OxoF+0pyyh0+Svi88q4+kA
 Fl14DmgNsP352Yp5m0mq0ns=
X-Google-Smtp-Source: ABdhPJwLBU4mvarvrZnXcv4YRUzi51SQVk5X7gIq5BfciyTEHcgMkqhiz58ygxmtn6GLedsckqeXiw==
X-Received: by 2002:a62:7989:0:b0:47b:e0f6:de0f with SMTP id
 u131-20020a627989000000b0047be0f6de0fmr5883140pfc.42.1635076071020; 
 Sun, 24 Oct 2021 04:47:51 -0700 (PDT)
Received: from localhost ([103.125.234.210])
 by smtp.gmail.com with ESMTPSA id e6sm15500083pfm.212.2021.10.24.04.47.49
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 24 Oct 2021 04:47:50 -0700 (PDT)
From: Ihor Radchenko <yantar92@gmail.com>
To: =?utf-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@gmail.com>
Subject: [PATCH] Re: [BUG] indention of drawer does not work [9.5
 (release_9.5-145-gd18beb @ /home/oub/emacs/site-lisp/packages/org/)]
In-Reply-To: <87pmrupu0s.fsf@gmail.com>
References: <87a6j02qf0.fsf@mat.ucm.es> <87pmrupu0s.fsf@gmail.com>
Date: Sun, 24 Oct 2021 19:49:15 +0800
Message-ID: <87fssqtzgk.fsf@localhost>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::430;
 envelope-from=yantar92@gmail.com; helo=mail-pf1-x430.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-orgmode@gnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Cc: Uwe Brauer <oub@mat.ucm.es>, emacs-orgmode@gnu.org
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: "Emacs-orgmode" <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1635076141;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=X05YAiylEPT8cnkXQu4Bg5EfN3C3Mcbic6jfJfIEnfA=;
	b=CP+EE5fWp+j7456HwZ8S+xJxhicfz0r539m/ydQb2EmxXttdUP/80BU0hrBM4n7JvDtdZq
	0O5CA+Cio7OdACtNatK4tDafdH3QyGWZrA2p+EFZHyPixVWl6lQuSrvakpEL0TiUGrnnGc
	9W5hGKvsmtToxMbX9MqIaH7/Ws2RJ+M7hM6PQlIczC4mau4Uf89cJXpdk1WcpX9Nh4o3gD
	MYf3S364vIALn4gyOa3YWJ6IvZbVOGddvl9yo/Dd93nmSGVpMuNXYfqlrCq5L646yynUj/
	xgtdZ8j5n/B06Kg+mN4wcApI5c4+uLYp0/+FMGcWAIUqqD3vzzx3EK1FApQ5ag==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635076141; a=rsa-sha256; cv=none;
	b=cmmEQenQoGBhc49faDpR5SBENwCnjs4+AhFpjNGEhb4Y1edJiZmRvUiphx5z8x01bp7VsT
	zOVURHgpcCAqkAv5Rst43uyndLO0G/Kd+9q7f/cCS4i3Uleb2mKqxkclB6nGYpZafKvuix
	Q8vWcebiAnLEz2OjE9dokcBVQurlxMnrwdoxH8z1TgbbSClly/KphfTWV0rB3DbFaqYxbg
	fpniIWF7Hr0j6dYJ2G2sE4NUEYTnWLfTRgeBxf7tSmaS5cBxE8BzOj8EHfpAw9STTU4NHq
	IXBxB69/sNhEMf3wNswiYAxFwE3HxvqomkZfOhacHEX7lWYN6PjkotgnYNJ/6Q==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=hvmLdhNB;
	spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org
X-Migadu-Spam-Score: -2.62
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=hvmLdhNB;
	dmarc=pass (policy=none) header.from=gmail.com;
	spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org
X-Migadu-Queue-Id: D3E8B27157
X-Spam-Score: -2.62
X-Migadu-Scanner: scn0.migadu.com
X-TUID: fVhO9LUpFj0T

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

K=C3=A9vin 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


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-org-get-expected-indentation-Consider-section-parent.patch

>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


--=-=-=--