From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id AISyMvt0zGK2eQAAbAwnHQ (envelope-from ) for ; Mon, 11 Jul 2022 21:07:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0JibMvt0zGKv9gAAauVa8A (envelope-from ) for ; Mon, 11 Jul 2022 21:07:39 +0200 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 3A30110733 for ; Mon, 11 Jul 2022 21:07:39 +0200 (CEST) Received: from localhost ([::1]:38636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAyks-0001ir-A1 for larch@yhetil.org; Mon, 11 Jul 2022 15:07:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAygP-0008Vh-QZ for emacs-orgmode@gnu.org; Mon, 11 Jul 2022 15:03:02 -0400 Received: from core-01.0k.io ([135.125.104.6]:53222 helo=mail.kalysto.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAygL-0002P8-Pq for emacs-orgmode@gnu.org; Mon, 11 Jul 2022 15:03:00 -0400 Received: from localhost (localhost.localnet [127.0.0.1]) by mail.kalysto.org (Postfix) with ESMTP id D4DF353F5E; Mon, 11 Jul 2022 19:02:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at kal.fr Received: from mail.kalysto.org ([127.0.0.1]) by localhost (mail.kal.fr [127.0.0.1]) (amavisd-new, port 10024) with LMTP id RqUTwR5U97Im; Mon, 11 Jul 2022 19:02:53 +0000 (UTC) Received: from [192.168.97.96] (82-64-236-101.subs.proxad.net [82.64.236.101]) by mail.kalysto.org (Postfix) with ESMTPSA id B411353F5D; Mon, 11 Jul 2022 19:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalysto.org; s=default; t=1657566172; bh=+Tjun+/YDCfYOu3msGkGpdUvSEmqQ3+F6eQTBqGiipA=; h=Date:Subject:To:References:From:Cc:In-Reply-To:From; b=qc34A6B/CaN5TzwAgHRhyIRYOlm6zhTlwb7VQZuxoGZRAJAKJFeKkmgxVjOhgDgPM 00HesXTT99eUAcbi8WAWJgsAjpo0qHDbGwikNSvMh7n9C8N6ITgs884Tok7+7TGydv 33BdbrtsP9w9BQe/NzTFlRPIX+XNkEuue4iVTM0M= Message-ID: Date: Mon, 11 Jul 2022 21:02:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [feature] Consistent fixed indentation of headline data Content-Language: en-US To: Ihor Radchenko References: <2fcae365-97cf-ccc4-23f0-2fc5c110dd69@kalysto.org> <87v8s9urvg.fsf@localhost> From: Valentin Lab Cc: emacs-orgmode@gnu.org In-Reply-To: <87v8s9urvg.fsf@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=135.125.104.6; envelope-from=valentin.lab@kalysto.org; helo=mail.kalysto.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1657566459; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=jl/YX7YWs3aAxvrx51whH93mdbOlOnHJ+Bzv6cbX5gY=; b=rWm3C5MLZvb3NHY+TxRI+IcRNqPjF5DQ9le6PD+g0jG1mCpB8RGkW7iKo+mzlmo1rWgLUn 3M2R2HRq/wpDtf7aS0DLtEWFOXMyQ/nAs0FaK8jZ58gyJuHL0jHCa2CIaMFSNWDpGUxO8v 7UJIsm9hV8UOBmzQ+5L1zfecCHeEU3UlFyQVEtnKwRGX9QmVjilO11x2CvFqZoM805la5g Qw8maPZiU1eJ9mjF4Jsjj9qLoDWxB8Ns++p2oqdkIvDhaGsT5UQbgxc8Z4VRXbnnbeInG2 m0cAmJQmFNFkuTYJtQEh+hHGArpyooxlrapmAox62iBYhOrGCll59vmVxXP2pg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657566459; a=rsa-sha256; cv=none; b=qM78nKV66x5ClItj+nqQ/zWcjS8C1uqvcBCcC/dTsmsD3nuJNojKxNyGzFWHqtZDtKCD5T U/1EEJZCB1KFdIyeAQJaRoJNB3NJxnsieeg1I9+ua6J61PqTbd4kWLS1eYcwuvkHxPSAwD qSk219EM/FzvF7KksEj6FBNfO1vWLjLfLQCAQXQ0uPIo/ovRnsH+EhFNUavJCvU6KhQyjQ 0PfzEH6X7F0eAULDNzbExkXFZEKZ30DkVoWLue7AYZeBLRWiaAp1udW1ECeW1Z4zlP40zw XmXGiJCKNBMnDRZFRrVLV957A6HmrIac1XcBTuJtb21r5JcbeJiqZMrbVg47sw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=kalysto.org header.s=default header.b="qc34A6B/"; dmarc=pass (policy=quarantine) header.from=kalysto.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.95 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kalysto.org header.s=default header.b="qc34A6B/"; dmarc=pass (policy=quarantine) header.from=kalysto.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 3A30110733 X-Spam-Score: -3.95 X-Migadu-Scanner: scn1.migadu.com X-TUID: Ioddc1c0v4Un Many thanks for your warm welcome, kind review and suggestions. I do not provide a corrective patch in this email, but it'll come soon depending on possible other remarks or follow-ups of this email. On 07/07/2022 12:41, Ihor Radchenko wrote: > Valentin Lab writes: > > Note that we rarely change the defaults. This particular change came > after extensive discussion: > https://orgmode.org/list/878s4x3bwh.fsf@gnu.org > Also, it has been documented in https://orgmode.org/Changes.html > I recommend reviewing the changes every time you update Org to new > version. > These links are very informative and give me much more insight on the current situation. Sorry if I didn't know how to get this info by myself. I've read the full thread you've linked. > Note that introducing a new customization should be documented in > etc/ORG-NEWS file and probably also in the manual (17.4.2 Hard > indentation). Yes, I was aware of that, but didn't want to spend to much time if my contribution was deemed not pertinent. > > Also, I am not sure if we really need a new custom variable. We already > have many. What about simply allowing an integer value of > org-adapt-indentation? > Well, my guess was that the "adapt" word in `org-adapt-indentation' was referring to adaptive (in other words: "changing") indentation depending on the depth of the outline. It seemed at first un-natural to force a fixed behavior here. This is why I went with a sub-behavior of when `org-adapt-indentation' was set to nil, a way to tell that we didn't want adaptive indentation. It also had the advantage to separate the implementation and help writing code that would not break the existing behaviors. Of course, I'm completely okay to go with your suggestion. Although, I'm at a lack of inspiration about what would be the best option here: wouldn't a simple integer as you suggest hide the fact that this will target only the headline data ? Could we think of more structured value, perhaps like a cons =(`headline-data . 2)= ? I'm afraid these additions could be seen as bringing some unwanted complexity. Although I'm expressing some doubts, I'm ready to implement it using an integer on `org-adapt-indentation' as you suggest. Just wanted to make sure it seem sound to everyone before committing to a change that is not that trivial (well, compared to actual changes). >> TINYCHANGE >> >> Signed-off-by: Valentin Lab > > Note that your patch is _not_ a tiny change (not <15 LOC). > See https://orgmode.org/worg/org-contribute.html#first-patch and > https://orgmode.org/worg/org-contribute.html#copyright > Would you consider signing the copyright assignment papers with FSF? Ok, I was not sure about that (counting the actual functional code change was still under 15LOC, but I guess test counts also). I'm in the process of signing the copyright assignment papers. > >> @@ -18371,6 +18386,9 @@ ELEMENT." >> ;; a footnote definition. >> (org--get-expected-indentation >> (org-element-property :parent previous) t)))))))))) >> + ((and (not (eq org-headline-data-fixed-indent-level nil)) >> + (memq type '(drawer property-drawer planning node-property clock))) >> + org-headline-data-fixed-indent-level) >> ;; Otherwise, move to the first non-blank line above. > > Why clock? It does not belong to property drawers. > I probably lack some important knowledge here to understand your point. Here's what I understand: `clock' type targets the 'CLOCK:' keyword (and not direct timestamps, I added a test to make sure). AFAIK, these 'CLOCK:' lines are made with 'C-c C-x C-i/o' and usually appears in between a ':LOGBOOK:' drawer. However older implementation of org-mode did not include these 'CLOCK: ...' lines in logbook drawers. My intention here, was to make sure that even these orphaned 'CLOCK: ...' lines, when appearing before any content, would be considered as headline data, and as such, be indented by the fixed amount. I definitively consider the logbook (and clock out of logbooks), property drawer, and planning info ("SCHEDULED", "DEADLINE") as headline data and are all targeted for indentation. In my code, if I remove `clock' in the list of types, the intended test about 'CLOCK:' fails... >> @@ -1216,6 +1259,13 @@ >> (org-test-with-temp-text "* H\n:PROPERTIES:\n:key:\n:END:" >> (org-indent-region (point-min) (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:\n\ncontent2" >> + ;; (org-test-with-temp-text "* H\n:PROPERTIES:\n:key:\n:END:\n\ncontent" >> + ;; (org-indent-region (point-min) (point-max)) >> + ;; (buffer-string))))) > > This test is commented. Is it intentional? My bad ! and an interesting talking point. I'm removing these commented line in the upcoming patch. They were here (and inadvertently committed) because while trying to test that my addition would not indent beyond the headline data, I noticed that actually `org-adapt-indentation' set to `headline-data' was actually indenting beyond headline data ! As I don't want to break anything, I was left quite puzzled with what to do: - I can fix this, but fixing this is for me subject to another submission, and will touch behaviors that might be wanted, - Not fixing this make me submitting a feature that carries what I see like a "bug". But, is that a bug ? Here is the case: --8<---------------cut here---------------start------------->8--- * H :PROPERTIES: :key: :END: content --8<---------------cut here---------------start------------->8--- Using `org-indent-region' on all the content, with `org-adapt-indentation' set to `headline-data', will result to: --8<---------------cut here---------------start------------->8--- * H :PROPERTIES: :key: :END: content --8<---------------cut here---------------start------------->8--- My issue is with the treatment of the 'content' line that is not headline-data for me, and should not have been indented. Am I right in my expectation ? Here is the test that fails (that can be copy/pasted): #+begin_src emacs-lisp ;; ... (let ((org-adapt-indentation 'headline-data)) (should (equal "* H\n :PROPERTIES:\n :key:\n :END:\n\ncontent" (org-test-with-temp-text "* H\n:PROPERTIES:\n:key:\n:END:\n\ncontent" (org-indent-region (point-min) (point-max)) (buffer-string))))) ;; ... #+end_src Many thanks for any insights on this point. Thanks for your review, suggestions and advices, Best, Valentin Lab