From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id IAbcMkIxwV5qCQAA0tVLHw (envelope-from ) for ; Sun, 17 May 2020 12:42:42 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id WB4kLkIxwV5+TAAA1q6Kng (envelope-from ) for ; Sun, 17 May 2020 12:42:42 +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 1EB089404E1 for ; Sun, 17 May 2020 12:42:42 +0000 (UTC) Received: from localhost ([::1]:36838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaIcr-0005wz-2F for larch@yhetil.org; Sun, 17 May 2020 08:42:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaIcV-0005wh-Vq for emacs-orgmode@gnu.org; Sun, 17 May 2020 08:42:20 -0400 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]:33010) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaIcU-0007vK-8X for emacs-orgmode@gnu.org; Sun, 17 May 2020 08:42:19 -0400 Received: by mail-lf1-x132.google.com with SMTP id z22so5618372lfd.0 for ; Sun, 17 May 2020 05:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=I95wpg1UAbrRbJXSAQU2Y39bBm0wg1qIBsASWzWXtQc=; b=ODlMVJRBf8JjuOJ+6fgxDGBGWlpJ/n9wPi+HUXa13F3FRpqCpt/5Ch1aiDVGRjsmOX jKVAwUvLXZATxTBbFPxmKfaYZ0amhc8Eqf4ehmg9ZDMDWKdLPiiQ2DkScemk5yhb2NO0 E/V5BgKCNKez7MBqxTeFEJY99slqEOnlibwZgSQgutjNHVb9kLWqZGMAosvwFRE/9uH2 DEWZOLKc4X2hW0WQFD5nK47md797rCTSaWSFDE6dKTfzkrqMcEIYVKvvhuovWfgIgaBx hLJ47N7LKEqumliC210AGNN1nhuXd7HmqMaMvYSU/K+XIDmEMUnvsD1c5w/6T47peQGy cDQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=I95wpg1UAbrRbJXSAQU2Y39bBm0wg1qIBsASWzWXtQc=; b=aOhrdOsxbcRYghfBWXqH4fnZbkkj3Tl6taawI2oYO+67Izgp3W3UaPJ+OTbcKR4QfG C4WE2UpFh3/7ps+reK8t5p2OFJvzq4W3MO/3nrKHrEtN6cSFTYaVO3BWFua4yvJ153SJ q2e2Z3q4HDIk7Jlpjj0x4wgV6cHxtv5yJTciyFNqNSIOSOgYJCQLrO/96GSuJAUco/7O syhlLbZUld5hkZryNXztkpf5EzXFWjjozZnKvkA2X7ABKiADJNvEef/byLsCe+1QxLBD 8mspwzeDYg26okBZbqzDAHKQ6QdfAbu0Ukx71u+I1b6zcXHIrIIJC4VoBnUp1mdtji3z qQFQ== X-Gm-Message-State: AOAM533LJHAqnSHxYtgI2aFog5ia1CQhNtDxxDBZo2RSmuZyYGAF8AJq L8v2TAmXXppMYiX+3zZc00r+L4gL X-Google-Smtp-Source: ABdhPJxPOs48K5l0IeuBPOh9MHvlB1iLqvBSK1hjyvwHwObijXYw275fZf7Hn8pho70xFj0dXIKMPQ== X-Received: by 2002:a05:6512:31c5:: with SMTP id j5mr8345523lfe.26.1589719335377; Sun, 17 May 2020 05:42:15 -0700 (PDT) Received: from [192.168.2.37] (ppp079166167134.access.hol.gr. [79.166.167.134]) by smtp.gmail.com with ESMTPSA id a12sm4102390ljj.64.2020.05.17.05.42.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 May 2020 05:42:14 -0700 (PDT) Subject: Re: Customizable fixed indentation column To: emacs-orgmode@gnu.org References: <67935568-9ced-d320-5c68-01f6e8298e48@gmail.com> <87tv0i8vym.fsf@nicolasgoaziou.fr> From: Panagiotis Vlantis Message-ID: Date: Sun, 17 May 2020 15:42:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <87tv0i8vym.fsf@nicolasgoaziou.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=panagiotis.vlantis.mc@gmail.com; helo=mail-lf1-x132.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=ODlMVJRB; 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-Spam-Score: -1.71 X-TUID: C0c0xtgzzzu1 Hello, On 5/14/20 4:52 PM, Nicolas Goaziou wrote: > Hello, > > Panagiotis Vlantis writes: > >> This is my first time using the mailing list so please point out if >> I am going about this the wrong way. > Thank you for the patch. You are welcome. > >> After searching a bit, I didn't find a way to specify a custom fixed >> indentation column in org sections; the current implementation >> automatically aligns content at the beginning of the line when >> `org-adapt-indentation' is set to nil, which I find somewhat >> restrictive (e.g., in this case, one should be careful when using >> lists beginning with '*' characters). > Starting list items with "*" is a terrible idea, indeed. However, it is > unlikely to break the document because list promotion commands handle > this case. > > I'm not convinced the current implementation is restrictive. OOC, do you > know any text-related mode that allows indenting contents at any column? > Also please note that if your first line is indented, all indentation > below will follow. Maybe restrictive was a bad way to put it. Nonetheless, I find being able to align contents at a column other than the first handy since it is easy to visually distinguish between staff without steadily losing usable space as the node level increases. This is especially noticeable when one follows a fixed line width layout and somehow ends up with 7 levels deep headings (not a good practice, I know :)) I have to admit that I am not aware of any text-related mode with this kind of feature either, although such customization (i.e., adaptive vs fixed indentation) is rather convenient in source code editing modes (e.g., `cc-mode', etc). >> To that end, I modified the current implementation accordingly (and >> added some tests) in order to allow one to set the desired indentation >> column to something other than the 0th, where section contents will be >> aligned at if adaptive indentation is disabled. >> >> I don't know if others will find this feature useful but I'll go and >> include the patch here anyway. If you find this worth merging but >> should be modified somehow before that, I would be happy to do so. > Instead of creating a new variable, what about overloading > `org-adapt-indentation'? If it is a whole number, use it as indentation. > `nil' becomes an alias for 0. > > WDYT? I tried out your suggestion and overloaded `org-adapt-indentation' instead of introducing a new variable. The corresponding patch can be seen below. Clearly, I am in no position to tell which implementation is better, although the latter feels a bit more complicated than the first. What is your opinion on this? > > Regards, > > -- > Nicolas Goaziou Best regard, Panagiotis Vlantis From 7e46937d1b188f913093f0ae66914803f51441e7 Mon Sep 17 00:00:00 2001 From: Panagiotis Vlantis Date: Sun, 17 May 2020 14:36:21 +0300 Subject: [PATCH] org: Enable selection of custom indentation column * lisp/org.el (org-adapt-indentation): Allow integer values to specify custom indentation column. (org--get-expected-indentation): Properly handle case when `org-adapt-indentation' is integer. (org-add-planning-info): Properly indent newly added planning info when `org-adapt-indentation' is integer. * testing/lisp/test-org.el (test-org/get-property-block, test-org/insert-property-drawer, test-org/indent-line, test-org/indent-region, test-org/add-planning-info, test-org/deadline, test-org/schedule, test-org/set-property): Modify tests depending on indentation and add more tests. Introduce variable and modify indentation mechanism accordingly in order to allow the user to specify a custom indentation column (other than zero) to be used instead of adaptive indentation. ---  lisp/org.el              |  47 ++++++----  testing/lisp/test-org.el | 190 ++++++++++++++++++++++++++++++++++++++-  2 files changed, 220 insertions(+), 17 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index dcd446745..487a81617 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1575,27 +1575,34 @@ lines to the buffer:  (defcustom org-adapt-indentation t    "Non-nil means adapt indentation to outline node level. -When this variable is set to t, Org assumes that you write +When this variable is non-nil, Org assumes that you write  outlines by indenting text in each node to align with the  headline (after the stars). -When this variable is set to 'headline-data, only adapt the -indentation of the data lines right below the headline, such as -planning/clock lines and property/logbook drawers. +In the special case this variable is set to 'headline-data, +only adapt the indentation of the data lines right below the headline, +such as planning/clock lines and property/logbook drawers. + +In the special case this variable is set to an integer value N, +section contents will be indented to the N-th column instead, +independently of the the corresponding outline node's level.  The following issues are influenced by this variable: -- The indentation is increased by one space in a demotion -  command, and decreased by one in a promotion command.  However, +- When this variable is set to a non-nil, non-integer value, +  the indentation is increased by one space in a demotion command, +  and decreased by one in a promotion command.  However,    in the latter case, if shifting some line in the entry body    would alter document structure (e.g., insert a new headline),    indentation is not changed at all.  - Property drawers and planning information is inserted indented -  when this variable is set.  When nil, they will not be indented. +  when this variable is non-nil.  When nil, they will not be indented. -- TAB indents a line relative to current level.  The lines below -  a headline will be indented when this variable is set to t. +- TAB indents a line relative to current level or at +  the specified column.  The lines below +  a headline will be indented when this variable is set to +  a non-nil value.  Note that this is all about true indentation, by adding and  removing space characters.  See also \"org-indent.el\" which does @@ -1606,8 +1613,11 @@ time in Emacs."        (const :tag "Adapt indentation for all lines" t)        (const :tag "Adapt indentation for headline data lines"           'headline-data) -      (const :tag "Do not adapt indentation at all" nil)) -  :safe #'booleanp) +      (const :tag "Do not adapt indentation at all" nil) +      integer) +  :safe #'(lambda (x) (or (booleanp x) +              (eq x 'headline-data) +              (integerp x))))  (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e) @@ -10642,7 +10652,9 @@ WHAT entry will also be removed."       (end-of-line)       (insert "\n")       (when org-adapt-indentation -       (indent-to-column (1+ (org-outline-level))))) +       (indent-to-column (if (integerp org-adapt-indentation) +                 (max org-adapt-indentation 0) +                   (1+ (org-outline-level))))))      (t nil)))       (when what         ;; Insert planning keyword. @@ -18737,9 +18749,14 @@ ELEMENT."         (cl-case type       ((diary-sexp footnote-definition) 0)       ((headline inlinetask nil) -      (if (not org-adapt-indentation) 0 -        (let ((level (org-current-level))) -          (if level (1+ level) 0)))) +      (let ((level (org-current-level))) +        (if level +        (if org-adapt-indentation +            (if (integerp org-adapt-indentation) +            (max org-adapt-indentation 0) +              (1+ level)) +          0) +          0)))       ((item plain-list) (org-list-item-body-column post-affiliated))       (t        (goto-char start) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index d22446a09..de9f9baf2 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -455,6 +455,12 @@          (let ((org-adapt-indentation nil))            (org-get-property-block nil 'force))          (buffer-string)))) +  (should +   (equal "* H\n     :PROPERTIES:\n     :END:\n" +      (org-test-with-temp-text "* H" +        (let ((org-adapt-indentation 5)) +          (org-get-property-block nil 'force)) +        (buffer-string))))    (should     (equal ":PROPERTIES:\n:END:\n"        (org-test-with-temp-text "" @@ -475,6 +481,12 @@        (org-test-with-temp-text ""          (let ((org-adapt-indentation nil)) (org-insert-property-drawer))          (buffer-string)))) +  (should +   (equal ":PROPERTIES:\n:END:\n" +      (org-test-with-temp-text "" +        (let ((org-adapt-indentation 5)) +          (org-insert-property-drawer)) +        (buffer-string))))    ;; Insert drawer in document header with existing comment and    ;; keyword.    (should @@ -506,6 +518,12 @@        (org-test-with-temp-text "* H\nParagraph"          (let ((org-adapt-indentation nil)) (org-insert-property-drawer))          (buffer-string)))) +  (should +   (equal "* H\n     :PROPERTIES:\n     :END:\nParagraph" +      (org-test-with-temp-text "* H\nParagraph" +        (let ((org-adapt-indentation 5)) +          (org-insert-property-drawer)) +        (buffer-string))))    (should     (equal "* H\nDEADLINE: <2014-03-04 tue.>\n:PROPERTIES:\n:END:\nParagraph"        (org-test-with-temp-text @@ -524,6 +542,12 @@        (org-test-with-temp-text "* H"          (let ((org-adapt-indentation nil)) (org-insert-property-drawer))          (buffer-string)))) +  (should +   (equal "* H\n     :PROPERTIES:\n     :END:\n" +      (org-test-with-temp-text "* H" +        (let ((org-adapt-indentation 5)) +          (org-insert-property-drawer)) +        (buffer-string))))    ;; Skip inlinetasks before point.    (when (featurep 'org-inlinetask)      (should @@ -852,6 +876,12 @@      (org-test-with-temp-text "* H\nA"        (let ((org-adapt-indentation nil)) (org-indent-line))        (org-get-indentation)))) +  (should +   (= 5 +    (org-test-with-temp-text "* H\nA" +      (let ((org-adapt-indentation 5)) +    (org-indent-line)) +      (org-get-indentation))))    ;; Indenting preserves point position.    (should     (org-test-with-temp-text "* H\nAB" @@ -1086,6 +1116,13 @@            (org-adapt-indentation nil))            (org-indent-region (point) (point-max)))          (buffer-string)))) +  (should +   (equal "* H\n  :PROPERTIES:\n  :key:      value\n  :END:" +      (org-test-with-temp-text "* H\n:PROPERTIES:\n:key: value\n:END:" +        (let ((org-property-format "%-10s %s") +          (org-adapt-indentation 2)) +          (org-indent-region (point) (point-max))) +        (buffer-string))))    (should     (equal "* H\n:PROPERTIES:\n:key:\n:END:"        (org-test-with-temp-text "* H\n:PROPERTIES:\n:key:\n:END:" @@ -1093,6 +1130,13 @@            (org-adapt-indentation nil))            (org-indent-region (point) (point-max)))          (buffer-string)))) +  (should +   (equal "* H\n     :PROPERTIES:\n     :key:\n     :END:" +      (org-test-with-temp-text "* H\n:PROPERTIES:\n:key:\n:END:" +        (let ((org-property-format "%-10s %s") +          (org-adapt-indentation 5)) +          (org-indent-region (point) (point-max))) +        (buffer-string))))    ;; Indent plain lists.    (should     (equal "- A\n  B\n  - C\n\n    D" @@ -4665,6 +4709,15 @@ Text.          (replace-regexp-in-string           "\\( [.A-Za-z]+\\)>" "" (buffer-string)           nil nil 1)))) +  ;; Create deadline when `org-adapt-indentation' is nil. +  (should +   (equal "* H\n     DEADLINE: <2015-06-25>\nParagraph" +      (org-test-with-temp-text "* H\nParagraph" +        (let ((org-adapt-indentation 5)) +          (org-add-planning-info 'deadline "<2015-06-25 Thu>")) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) +         nil nil 1))))    ;; Update deadline when `org-adapt-indentation' is non-nil.    (should     (equal "* H\n  DEADLINE: <2015-06-25>\nParagraph" @@ -4689,6 +4742,19 @@ Paragraph"          (replace-regexp-in-string           "\\( [.A-Za-z]+\\)>" "" (buffer-string)           nil nil 1)))) +  ;; Update deadline when `org-adapt-indentation' is nil. +  ;; (current mechanism respects existing indentation). +  (should +   (equal "* H\nDEADLINE: <2015-06-25>\nParagraph" +      (org-test-with-temp-text "\ +* H +DEADLINE: <2015-06-24 Wed> +Paragraph" +        (let ((org-adapt-indentation 5)) +          (org-add-planning-info 'deadline "<2015-06-25 Thu>")) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) +         nil nil 1))))    ;; Schedule when `org-adapt-indentation' is non-nil.    (should     (equal "* H\n  SCHEDULED: <2015-06-25>\nParagraph" @@ -4707,6 +4773,15 @@ Paragraph"          (replace-regexp-in-string           "\\( [.A-Za-z]+\\)>" "" (buffer-string)           nil nil 1)))) +  ;; Schedule when `org-adapt-indentation' is nil. +  (should +   (equal "* H\n     SCHEDULED: <2015-06-25>\nParagraph" +      (org-test-with-temp-text "* H\nParagraph" +        (let ((org-adapt-indentation 5)) +          (org-add-planning-info 'scheduled "<2015-06-25 Thu>")) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) +         nil nil 1))))    ;; Add deadline when scheduled.    (should     (equal "\ @@ -4799,6 +4874,29 @@ Paragraph"          (replace-regexp-in-string           "\\( [.A-Za-z]+\\)>" "" (buffer-string)           nil nil 1)))) +  ;; Remove closed when `org-adapt-indentation' is nil. +  (should +   (equal "* H\nDEADLINE: <2015-06-25>\nParagraph" +      (org-test-with-temp-text "\ +* H +CLOSED: [2015-06-25 Thu] DEADLINE: <2015-06-25 Thu> +Paragraph" +        (let ((org-adapt-indentation 5)) +          (org-add-planning-info nil nil 'closed)) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) +         nil nil 1)))) +  (should +   (equal "* H\nParagraph" +      (org-test-with-temp-text "\ +* H +  CLOSED: [2015-06-25 Thu] +Paragraph" +        (let ((org-adapt-indentation 5)) +          (org-add-planning-info nil nil 'closed)) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) +         nil nil 1))))    ;; Remove closed entry and delete empty line.    (should     (equal "\ @@ -4838,6 +4936,15 @@ Paragraph"          (replace-regexp-in-string           "\\( [.A-Za-z]+\\)>" "" (buffer-string)           nil nil 1)))) +  (should +   (equal "* H\n     DEADLINE: <2012-03-29>" +      (org-test-with-temp-text "* H" +        (let ((org-adapt-indentation 5) +          (org-last-inserted-timestamp nil)) +          (org-deadline nil "<2012-03-29 Tue>")) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) +         nil nil 1))))    (should     (equal "* H\nDEADLINE: <2014-03-04>"        (org-test-with-temp-text "* H\nDEADLINE: <2012-03-29>" @@ -4857,6 +4964,15 @@ Paragraph"          (org-deadline nil "+1y"))            (replace-regexp-in-string             "\\( [.A-Za-z]+\\)>" "" (buffer-string) nil nil 1))))) +  (should +   (equal "* H\n     DEADLINE: <2015-03-04>" +      (org-test-at-time "2014-03-04" +        (org-test-with-temp-text "* H" +          (let ((org-adapt-indentation 5) +            (org-last-inserted-timestamp nil)) +        (org-deadline nil "+1y")) +          (replace-regexp-in-string +           "\\( [.A-Za-z]+\\)>" "" (buffer-string) nil nil 1)))))    ;; Preserve repeater.    (should     (equal "* H\nDEADLINE: <2012-03-29 +2y>" @@ -4866,6 +4982,14 @@ Paragraph"            (org-deadline nil "<2012-03-29 Tue +2y>"))          (replace-regexp-in-string           "\\( [.A-Za-z]+\\) " "" (buffer-string) nil nil 1)))) +  (should +   (equal "* H\n     DEADLINE: <2012-03-29 +2y>" +      (org-test-with-temp-text "* H" +        (let ((org-adapt-indentation 5) +          (org-last-inserted-timestamp nil)) +          (org-deadline nil "<2012-03-29 Tue +2y>")) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\) " "" (buffer-string) nil nil 1))))    ;; Remove CLOSED keyword, if any.    (should     (equal "* H\nDEADLINE: <2012-03-29>" @@ -4952,6 +5076,15 @@ Paragraph"          (replace-regexp-in-string           "\\( [.A-Za-z]+\\)>" "" (buffer-string)           nil nil 1)))) +  (should +   (equal "* H\n     SCHEDULED: <2012-03-29>" +      (org-test-with-temp-text "* H" +        (let ((org-adapt-indentation 5) +          (org-last-inserted-timestamp nil)) +          (org-schedule nil "<2012-03-29 Tue>")) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) +         nil nil 1))))    (should     (equal "* H\nSCHEDULED: <2014-03-04>"        (org-test-with-temp-text "* H\nSCHEDULED: <2012-03-29>" @@ -4961,6 +5094,15 @@ Paragraph"          (replace-regexp-in-string           "\\( [.A-Za-z]+\\)>" "" (buffer-string)           nil nil 1)))) +  (should +   (equal "* H\nSCHEDULED: <2014-03-04>" +      (org-test-with-temp-text "* H\nSCHEDULED: <2012-03-29>" +        (let ((org-adapt-indentation 5) +          (org-last-inserted-timestamp nil)) +          (org-schedule nil "<2014-03-04 Thu>")) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) +         nil nil 1))))    ;; Accept delta time, e.g., "+2d".    (should     (equal "* H\nSCHEDULED: <2015-03-04>" @@ -4989,6 +5131,14 @@ Paragraph"            (org-schedule nil "<2012-03-29 Tue>"))          (replace-regexp-in-string           "\\( [.A-Za-z]+\\)>" "" (buffer-string) nil nil 1)))) +  (should +   (equal "* H\nSCHEDULED: <2012-03-29>" +      (org-test-with-temp-text "* H\nCLOSED: [2017-01-25 Wed]" +        (let ((org-adapt-indentation 5) +          (org-last-inserted-timestamp nil)) +          (org-schedule nil "<2012-03-29 Tue>")) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) nil nil 1))))    ;; With C-u argument, remove SCHEDULED keyword.    (should     (equal "* H\n" @@ -5041,6 +5191,18 @@ Paragraph"            (org-schedule nil "2012-03-29"))          (replace-regexp-in-string           "\\( [.A-Za-z]+\\)>" "" (buffer-string) nil nil 1)))) +  (should +   (equal "* H1\n     SCHEDULED: <2012-03-29>\n* H2\n SCHEDULED: <2012-03-29>" +      (org-test-with-temp-text "* H1\n* H2" +        (let ((org-adapt-indentation 5) +          (org-last-inserted-timestamp nil) +          (org-loop-over-headlines-in-active-region t)) +          (transient-mark-mode 1) +          (push-mark (point) t t) +          (goto-char (point-max)) +          (org-schedule nil "2012-03-29")) +        (replace-regexp-in-string +         "\\( [.A-Za-z]+\\)>" "" (buffer-string) nil nil 1))))    (should-not     (equal "* H1\nSCHEDULED: <2012-03-29>\n* H2\nSCHEDULED: <2012-03-29>"        (org-test-with-temp-text "* H1\n* H2" @@ -5153,14 +5315,38 @@ Paragraph"     (equal      ":PROPERTIES:\n:TEST: t\n:END:\n"      (org-test-with-temp-text "" -      (let ((org-property-format "%s %s")) +      (let ((org-property-format "%s %s") +        (org-adapt-indentation 0)) +    (org-set-property "TEST" "t")) +      (buffer-string)))) +  (should +   (equal +    ":PROPERTIES:\n:TEST: t\n:END:\n" +    (org-test-with-temp-text "" +      (let ((org-property-format "%s %s") +        (org-adapt-indentation nil)) +    (org-set-property "TEST" "t")) +      (buffer-string)))) +  (should +   (equal +    ":PROPERTIES:\n:TEST: t\n:END:\n" +    (org-test-with-temp-text "" +      (let ((org-property-format "%s %s") +        (org-adapt-indentation 5))      (org-set-property "TEST" "t"))        (buffer-string))))    (should     (equal      "* H\n:PROPERTIES:\n:TEST: t\n:END:\n"      (org-test-with-temp-text "* H" -      (let ((org-adapt-indentation nil) +      (let ((org-adapt-indentation nil) (org-property-format "%s %s")) +    (org-set-property "TEST" "t")) +      (buffer-string)))) +  (should +   (equal +    "* H\n     :PROPERTIES:\n     :TEST: t\n     :END:\n" +    (org-test-with-temp-text "* H" +      (let ((org-adapt-indentation 5)          (org-property-format "%s %s"))      (org-set-property "TEST" "t"))        (buffer-string))))) -- 2.26.2