emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [feature] Consistent fixed indentation of headline data


From: Ihor Radchenko
Subject: Re: [feature] Consistent fixed indentation of headline data
Date: Thu, 07 Jul 2022 18:41:39 +0800

Valentin Lab <valentin.lab@kalysto.org> writes:

> I'm using org-mode for a long time, and I never understood quite well 
> how headline data were supposed to be indented, however I was happy with 
> what emerged to me as the default of 2 spaces (with my emacs and 
> org-mode version at the time). I recently updated my old emacs to 
> =9.5.3=, and what I thought was a default indentation was removed.
>
> Suddenly, I had no indentation at all for these headline-data and this 
> bugged me.

First of all, thanks for the patch! New contributions are always
welcome.

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.

> I went through documentation, and code, and (re-)discovered 
> `org-adapt-indentation' that was nil in my case and is intended to stay 
> this way as far as I am concerned : I'm looking for a fixed indentation 
> whatever the depth of my outlines.
>
> I'm far from sure it was a default one day, but sure it was at least 
> suggested/enforced in my workflow with my emacs at some time. And even 
> if it didn't feel like it was clad in iron, it seems I'm not the only 
> one who was using that as I can find some examples remaining in the 
> current 'testing/examples' org files.
>
> This indentation concerns only what is called "headline data" in the 
> documentation of `org-adapt-indentation'. To be precise: schedules 
> ("SCHEDULE:", "DEADLINE:"...), clock drawer (":LOGBOOK:..."), property 
> drawer (":PROPERTY:..."). These are "data" appearing after the headline 
> as I understand them.

This sounds like a reasonable addition.

> If I'm a user of org-mode, I'm fairly new in the emacs lisp and hacking 
> community and I need to know:
> - if my proposal is useful and has any chance to be accepted,

It looks useful for me.

> - if there are any pitfalls I delved into in matter of coding, 
> conventions, ...

I will provide some comments on the patch below.
In general, the patch looks nice. Providing tests is especially welcome.

> Subject: [PATCH] org-el: Add fixed indentation of headline data
>
> * lisp/org.el (org-headline-data-fixed-indent-level): Definition of
> new customizable variable and doc.
> (org-add-planning-info): When creating planning line, force a
> `org-indent-line' to indent it correctly.
> (org--get-expected-indentation): If variable
> `org-headline-data-fixed-indent-level' is set and line is header,
> inform `org-indent-line' to indent from specified amount.
> (org-adapt-indentation): Update documentation to mention new
> `org-headline-data-fixed-indent-level'.

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

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?

> TINYCHANGE
>
> Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>

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?

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

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

Best,
Ihor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]