emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Customizable fixed indentation column
@ 2020-05-10 17:42 Panagiotis Vlantis
  2020-05-14 13:52 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Panagiotis Vlantis @ 2020-05-10 17:42 UTC (permalink / raw)
  To: emacs-orgmode

Hello to all,

This is my first time using the mailing list so please point out if I am 
going about this the wrong way.

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

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.

Best regards,
Panagiotis


 From 9b24257aeb11fa6f1d00eae0ac48fe0f92ca2dad Mon Sep 17 00:00:00 2001
From: Panagiotis Vlantis <panagiotis.vlantis.mc@gmail.com>
Date: Sun, 10 May 2020 18:09:00 +0300
Subject: [PATCH] org: Enable selection of custom indentation column

* lisp/org.el (org--get-expected-indentation): Return value of
`org-fixed-indentation' when `org-adapt-indentation' is nil.
(org-add-planning-info): Properly indent newly added planning info.
(org-fixed-indentation): Introduce customizable variable for preferred
fixed indentation column.

* 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 when adaptive indentation is disabled.

TINYCHANGE
---
  lisp/org.el              |  18 ++-
  testing/lisp/test-org.el | 293 ++++++++++++++++++++++++++++++++++++---
  2 files changed, 290 insertions(+), 21 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 9b9b4376b..d87d449f7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10639,8 +10639,9 @@ WHAT entry will also be removed."
      (what
       (end-of-line)
       (insert "\n")
-     (when org-adapt-indentation
-       (indent-to-column (1+ (org-outline-level)))))
+     (indent-to-column (if org-adapt-indentation
+                      (1+ (org-outline-level))
+                    (max org-fixed-indentation 0))))
      (t nil)))
       (when what
         ;; Insert planning keyword.
@@ -18720,6 +18721,16 @@ hierarchy of headlines by UP levels before 
marking the subtree."

  ;;; Indentation

+(defcustom org-fixed-indentation 0
+  "Preferred indentation column when adaptive indentation is disabled.
+
+When `org-adapt-indentation' is nil, the contents of sections
+shall be indented to the column specified by this variable,
+independently of the the corresponding section's level."
+  :group 'org-edit-structure
+  :type 'integer
+  :safe #'integerp)
+
  (defvar org-element-greater-elements)
  (defun org--get-expected-indentation (element contentsp)
    "Expected indentation column for current line, according to ELEMENT.
@@ -18735,7 +18746,8 @@ ELEMENT."
         (cl-case type
       ((diary-sexp footnote-definition) 0)
       ((headline inlinetask nil)
-      (if (not org-adapt-indentation) 0
+      (if (not org-adapt-indentation)
+          (if (org-current-level) (max org-fixed-indentation 0) 0)
          (let ((level (org-current-level)))
            (if level (1+ level) 0))))
       ((item plain-list) (org-list-item-body-column post-affiliated))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index a0f505cbc..baaf6d800 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -452,7 +452,15 @@
    (should
     (equal "* H\n:PROPERTIES:\n:END:\n"
        (org-test-with-temp-text "* H"
-        (let ((org-adapt-indentation nil))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (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 nil)
+          (org-fixed-indentation 5))
            (org-get-property-block nil 'force))
          (buffer-string))))
    (should
@@ -473,7 +481,16 @@
    (should
     (equal ":PROPERTIES:\n:END:\n"
        (org-test-with-temp-text ""
-        (let ((org-adapt-indentation nil)) (org-insert-property-drawer))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (org-insert-property-drawer))
+        (buffer-string))))
+  (should
+   (equal ":PROPERTIES:\n:END:\n"
+      (org-test-with-temp-text ""
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5))
+          (org-insert-property-drawer))
          (buffer-string))))
    ;; Insert drawer in document header with existing comment and
    ;; keyword.
@@ -504,13 +521,24 @@
    (should
     (equal "* H\n:PROPERTIES:\n:END:\nParagraph"
        (org-test-with-temp-text "* H\nParagraph<point>"
-        (let ((org-adapt-indentation nil)) (org-insert-property-drawer))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (org-insert-property-drawer))
+        (buffer-string))))
+  (should
+   (equal "* H\n     :PROPERTIES:\n     :END:\nParagraph"
+      (org-test-with-temp-text "* H\nParagraph<point>"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-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
            "* H\nDEADLINE: <2014-03-04 tue.>\nParagraph<point>"
-        (let ((org-adapt-indentation nil)) (org-insert-property-drawer))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (org-insert-property-drawer))
          (buffer-string))))
    ;; Indent inserted drawer.
    (should
@@ -522,7 +550,16 @@
    (should
     (equal "* H\n:PROPERTIES:\n:END:\n"
        (org-test-with-temp-text "* H"
-        (let ((org-adapt-indentation nil)) (org-insert-property-drawer))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (org-insert-property-drawer))
+        (buffer-string))))
+  (should
+   (equal "* H\n     :PROPERTIES:\n     :END:\n"
+      (org-test-with-temp-text "* H"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5))
+          (org-insert-property-drawer))
          (buffer-string))))
    ;; Skip inlinetasks before point.
    (when (featurep 'org-inlinetask)
@@ -531,6 +568,7 @@
          (org-test-with-temp-text
          "* H\n*************** I\n*************** END\nP<point>"
            (let ((org-adapt-indentation nil)
+            (org-fixed-indentation 0)
              (org-inlinetask-min-level 15))
          (org-insert-property-drawer))
            (buffer-string)))))
@@ -541,6 +579,7 @@
          (org-test-with-temp-text
          "* H\n*************** I\nP<point>\n*************** END"
            (let ((org-adapt-indentation nil)
+            (org-fixed-indentation 0)
              (org-inlinetask-min-level 15))
          (org-insert-property-drawer))
            (buffer-string))))))
@@ -850,7 +889,16 @@
    (should
     (zerop
      (org-test-with-temp-text "* H\n<point>A"
-      (let ((org-adapt-indentation nil)) (org-indent-line))
+      (let ((org-adapt-indentation nil)
+        (org-fixed-indentation 0))
+    (org-indent-line))
+      (org-get-indentation))))
+  (should
+   (= 5
+    (org-test-with-temp-text "* H\n<point>A"
+      (let ((org-adapt-indentation nil)
+        (org-fixed-indentation 5))
+    (org-indent-line))
        (org-get-indentation))))
    ;; Indenting preserves point position.
    (should
@@ -1083,14 +1131,32 @@
     (equal "* H\n:PROPERTIES:\n:key:      value\n:END:"
        (org-test-with-temp-text "* H\n<point>:PROPERTIES:\n:key: 
value\n:END:"
          (let ((org-property-format "%-10s %s")
-          (org-adapt-indentation nil))
+          (org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (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<point>:PROPERTIES:\n:key: 
value\n:END:"
+        (let ((org-property-format "%-10s %s")
+          (org-adapt-indentation nil)
+          (org-fixed-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<point>:PROPERTIES:\n:key:\n:END:"
          (let ((org-property-format "%-10s %s")
-          (org-adapt-indentation nil))
+          (org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (org-indent-region (point) (point-max)))
+        (buffer-string))))
+  (should
+   (equal "* H\n     :PROPERTIES:\n     :key:\n     :END:"
+      (org-test-with-temp-text "* H\n<point>:PROPERTIES:\n:key:\n:END:"
+        (let ((org-property-format "%-10s %s")
+          (org-adapt-indentation nil)
+          (org-fixed-indentation 5))
            (org-indent-region (point) (point-max)))
          (buffer-string))))
    ;; Indent plain lists.
@@ -4647,11 +4713,24 @@ Text.
          (replace-regexp-in-string
           "\\( [.A-Za-z]+\\)>" "" (buffer-string)
           nil nil 1))))
-  ;; Create deadline when `org-adapt-indentation' is nil.
+  ;; Create deadline when `org-adapt-indentation' is nil and
+  ;; `org-fixed-indentation' is 0.
    (should
     (equal "* H\nDEADLINE: <2015-06-25>\nParagraph"
        (org-test-with-temp-text "* H\nParagraph<point>"
-        (let ((org-adapt-indentation nil))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (org-add-planning-info 'deadline "<2015-06-25 Thu>"))
+        (replace-regexp-in-string
+         "\\( [.A-Za-z]+\\)>" "" (buffer-string)
+         nil nil 1))))
+  ;; Create deadline when `org-adapt-indentation' is nil and
+  ;; `org-fixed-indentation' is 5.
+  (should
+   (equal "* H\n     DEADLINE: <2015-06-25>\nParagraph"
+      (org-test-with-temp-text "* H\nParagraph<point>"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5))
            (org-add-planning-info 'deadline "<2015-06-25 Thu>"))
          (replace-regexp-in-string
           "\\( [.A-Za-z]+\\)>" "" (buffer-string)
@@ -4668,14 +4747,31 @@ Paragraph<point>"
          (replace-regexp-in-string
           "\\( [.A-Za-z]+\\)>" "" (buffer-string)
           nil nil 1))))
-  ;; Update deadline when `org-adapt-indentation' is nil.
+  ;; Update deadline when `org-adapt-indentation' is nil and
+  ;; `org-fixed-indentation' is 0.
+  (should
+   (equal "* H\nDEADLINE: <2015-06-25>\nParagraph"
+      (org-test-with-temp-text "\
+* H
+DEADLINE: <2015-06-24 Wed>
+Paragraph<point>"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (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 nil and
+  ;; `org-fixed-indentation' is 5.
+  ;; (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<point>"
-        (let ((org-adapt-indentation nil))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5))
            (org-add-planning-info 'deadline "<2015-06-25 Thu>"))
          (replace-regexp-in-string
           "\\( [.A-Za-z]+\\)>" "" (buffer-string)
@@ -4689,11 +4785,24 @@ Paragraph<point>"
          (replace-regexp-in-string
           "\\( [.A-Za-z]+\\)>" "" (buffer-string)
           nil nil 1))))
-  ;; Schedule when `org-adapt-indentation' is nil.
+  ;; Schedule when `org-adapt-indentation' is nil and
+  ;; `org-fixed-indentation' is 0.
    (should
     (equal "* H\nSCHEDULED: <2015-06-25>\nParagraph"
        (org-test-with-temp-text "* H\nParagraph<point>"
-        (let ((org-adapt-indentation nil))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (org-add-planning-info 'scheduled "<2015-06-25 Thu>"))
+        (replace-regexp-in-string
+         "\\( [.A-Za-z]+\\)>" "" (buffer-string)
+         nil nil 1))))
+  ;; Schedule when `org-adapt-indentation' is nil and
+  ;; `org-fixed-indentation' is 5.
+  (should
+   (equal "* H\n     SCHEDULED: <2015-06-25>\nParagraph"
+      (org-test-with-temp-text "* H\nParagraph<point>"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5))
            (org-add-planning-info 'scheduled "<2015-06-25 Thu>"))
          (replace-regexp-in-string
           "\\( [.A-Za-z]+\\)>" "" (buffer-string)
@@ -4767,14 +4876,43 @@ Paragraph<point>"
          (replace-regexp-in-string
           "\\( [.A-Za-z]+\\)>" "" (buffer-string)
           nil nil 1))))
-  ;; Remove closed when `org-adapt-indentation' is nil.
+  ;; Remove closed when `org-adapt-indentation' is nil and
+  ;; `org-fixed-indentation' is 0.
+  (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<point>"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (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<point>"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0))
+          (org-add-planning-info nil nil 'closed))
+        (replace-regexp-in-string
+         "\\( [.A-Za-z]+\\)>" "" (buffer-string)
+         nil nil 1))))
+  ;; Remove closed when `org-adapt-indentation' is nil and
+  ;; `org-fixed-indentation' is 5
+  ;; (current mechanism respects existing indentation).
    (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<point>"
-        (let ((org-adapt-indentation nil))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5))
            (org-add-planning-info nil nil 'closed))
          (replace-regexp-in-string
           "\\( [.A-Za-z]+\\)>" "" (buffer-string)
@@ -4785,7 +4923,8 @@ Paragraph<point>"
  * H
    CLOSED: [2015-06-25 Thu]
  Paragraph<point>"
-        (let ((org-adapt-indentation nil))
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5))
            (org-add-planning-info nil nil 'closed))
          (replace-regexp-in-string
           "\\( [.A-Za-z]+\\)>" "" (buffer-string)
@@ -4824,6 +4963,17 @@ Paragraph<point>"
     (equal "* H\nDEADLINE: <2012-03-29>"
        (org-test-with-temp-text "* H"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
+          (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\n     DEADLINE: <2012-03-29>"
+      (org-test-with-temp-text "* H"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5)
            (org-last-inserted-timestamp nil))
            (org-deadline nil "<2012-03-29 Tue>"))
          (replace-regexp-in-string
@@ -4844,6 +4994,17 @@ Paragraph<point>"
        (org-test-at-time "2014-03-04"
          (org-test-with-temp-text "* H"
            (let ((org-adapt-indentation nil)
+            (org-fixed-indentation 0)
+            (org-last-inserted-timestamp nil))
+        (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 nil)
+            (org-fixed-indentation 5)
              (org-last-inserted-timestamp nil))
          (org-deadline nil "+1y"))
            (replace-regexp-in-string
@@ -4853,6 +5014,16 @@ Paragraph<point>"
     (equal "* H\nDEADLINE: <2012-03-29 +2y>"
        (org-test-with-temp-text "* H"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
+          (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))))
+  (should
+   (equal "* H\n     DEADLINE: <2012-03-29 +2y>"
+      (org-test-with-temp-text "* H"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5)
            (org-last-inserted-timestamp nil))
            (org-deadline nil "<2012-03-29 Tue +2y>"))
          (replace-regexp-in-string
@@ -4910,6 +5081,7 @@ Paragraph<point>"
     (equal "* H1\nDEADLINE: <2012-03-29>\n* H2\nDEADLINE: <2012-03-29>"
        (org-test-with-temp-text "* H1\n* H2"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
            (org-last-inserted-timestamp nil)
            (org-loop-over-headlines-in-active-region t))
            (transient-mark-mode 1)
@@ -4922,6 +5094,7 @@ Paragraph<point>"
     (equal "* H1\nDEADLINE: <2012-03-29>\n* H2\nDEADLINE: <2012-03-29>"
        (org-test-with-temp-text "* H1\n* H2"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
            (org-last-inserted-timestamp nil)
            (org-loop-over-headlines-in-active-region nil))
            (transient-mark-mode 1)
@@ -4938,15 +5111,37 @@ Paragraph<point>"
     (equal "* H\nSCHEDULED: <2012-03-29>"
        (org-test-with-temp-text "* H"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
            (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\n     SCHEDULED: <2012-03-29>"
+      (org-test-with-temp-text "* H"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-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>"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
+          (org-last-inserted-timestamp nil))
+          (org-schedule nil "<2014-03-04 Thu>"))
+        (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 nil)
+          (org-fixed-indentation 5)
            (org-last-inserted-timestamp nil))
            (org-schedule nil "<2014-03-04 Thu>"))
          (replace-regexp-in-string
@@ -4958,6 +5153,7 @@ Paragraph<point>"
        (org-test-at-time "2014-03-04"
          (org-test-with-temp-text "* H"
            (let ((org-adapt-indentation nil)
+            (org-fixed-indentation 0)
              (org-last-inserted-timestamp nil))
          (org-schedule nil "+1y"))
            (replace-regexp-in-string
@@ -4967,6 +5163,7 @@ Paragraph<point>"
     (equal "* H\nSCHEDULED: <2012-03-29 +2y>"
        (org-test-with-temp-text "* H"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
            (org-last-inserted-timestamp nil))
            (org-schedule nil "<2012-03-29 Tue +2y>"))
          (replace-regexp-in-string
@@ -4976,6 +5173,16 @@ Paragraph<point>"
     (equal "* H\nSCHEDULED: <2012-03-29>"
        (org-test-with-temp-text "* H\nCLOSED: [2017-01-25 Wed]"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
+          (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: <2012-03-29>"
+      (org-test-with-temp-text "* H\nCLOSED: [2017-01-25 Wed]"
+        (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 5)
            (org-last-inserted-timestamp nil))
            (org-schedule nil "<2012-03-29 Tue>"))
          (replace-regexp-in-string
@@ -4985,6 +5192,7 @@ Paragraph<point>"
     (equal "* H\n"
        (org-test-with-temp-text "* H\nSCHEDULED: <2012-03-29>"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
            (org-last-inserted-timestamp nil))
            (org-schedule '(4)))
          (buffer-string))))
@@ -4992,6 +5200,7 @@ Paragraph<point>"
     (equal "* H"
        (org-test-with-temp-text "* H"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation)
            (org-last-inserted-timestamp nil))
            (org-schedule '(4)))
          (buffer-string))))
@@ -5004,6 +5213,7 @@ Paragraph<point>"
                    (org-parse-time-string "2014-03-04")))))
          (org-test-with-temp-text "* H\nSCHEDULED: <2012-03-29>"
            (let ((org-adapt-indentation nil)
+            (org-fixed-indentation 0)
              (org-last-inserted-timestamp nil))
          (org-schedule '(16)))
            (buffer-string)))))
@@ -5014,6 +5224,7 @@ Paragraph<point>"
                 (org-parse-time-string "2014-03-04")))))
       (org-test-with-temp-text "* H"
         (let ((org-adapt-indentation nil)
+         (org-fixed-indentation 0)
           (org-last-inserted-timestamp nil))
       (org-schedule '(16)))
         (buffer-string))))
@@ -5024,6 +5235,20 @@ Paragraph<point>"
     (equal "* H1\nSCHEDULED: <2012-03-29>\n* H2\nSCHEDULED: <2012-03-29>"
        (org-test-with-temp-text "* H1\n* H2"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
+          (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
+   (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 nil)
+          (org-fixed-indentation 5)
            (org-last-inserted-timestamp nil)
            (org-loop-over-headlines-in-active-region t))
            (transient-mark-mode 1)
@@ -5036,6 +5261,7 @@ Paragraph<point>"
     (equal "* H1\nSCHEDULED: <2012-03-29>\n* H2\nSCHEDULED: <2012-03-29>"
        (org-test-with-temp-text "* H1\n* H2"
          (let ((org-adapt-indentation nil)
+          (org-fixed-indentation 0)
            (org-last-inserted-timestamp nil)
            (org-loop-over-headlines-in-active-region nil))
            (transient-mark-mode 1)
@@ -5050,6 +5276,7 @@ Paragraph<point>"
      "\\* H\nSCHEDULED: <2017-02-01 [.A-Za-z]* \\+\\+7d>\n"
      (org-test-with-temp-text "* H\nSCHEDULED: <2017-01-19 ++7d>\n"
                   (let ((org-adapt-indentation nil)
+                   (org-fixed-indentation 0)
                     (org-last-inserted-timestamp nil))
                     (org-schedule nil "2017-02-01"))
                   (buffer-string)))))
@@ -5144,7 +5371,27 @@ Paragraph<point>"
     (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 t)
+        (org-fixed-indentation 5))
+    (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-fixed-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-fixed-indentation 5))
      (org-set-property "TEST" "t"))
        (buffer-string))))
    (should
@@ -5152,6 +5399,16 @@ Paragraph<point>"
      "* H\n:PROPERTIES:\n:TEST: t\n:END:\n"
      (org-test-with-temp-text "* H"
        (let ((org-adapt-indentation nil)
+        (org-fixed-indentation 0)
+        (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 nil)
+        (org-fixed-indentation 5)
          (org-property-format "%s %s"))
      (org-set-property "TEST" "t"))
        (buffer-string)))))
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-24 12:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-10 17:42 Customizable fixed indentation column Panagiotis Vlantis
2020-05-14 13:52 ` Nicolas Goaziou
2020-05-17 12:42   ` Panagiotis Vlantis
2020-05-24 10:55     ` Bastien
2020-05-24 12:34       ` Panagiotis Vlantis

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).