From: Ihor Radchenko <yantar92@gmail.com>
To: Valentin Lab <valentin.lab@kalysto.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: [feature] Consistent fixed indentation of headline data
Date: Thu, 07 Jul 2022 18:41:39 +0800 [thread overview]
Message-ID: <87v8s9urvg.fsf@localhost> (raw)
In-Reply-To: <2fcae365-97cf-ccc4-23f0-2fc5c110dd69@kalysto.org>
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
next prev parent reply other threads:[~2022-07-07 10:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 14:59 [feature] Consistent fixed indentation of headline data Valentin Lab
2022-07-07 10:41 ` Ihor Radchenko [this message]
2022-07-11 19:02 ` Valentin Lab
2022-07-18 13:11 ` [PATCH] Fix bug in org-indent-region when org-adapt-indentation is set to headline-data (was: [feature] Consistent fixed indentation of headline data) Ihor Radchenko
2022-07-18 17:28 ` [PATCH] Fix bug in org-indent-region when org-adapt-indentation is set to headline-data Bastien Guerry
2022-07-19 13:59 ` Ihor Radchenko
2022-07-18 13:26 ` [feature] Consistent fixed indentation of headline data Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v8s9urvg.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=valentin.lab@kalysto.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).