Subject: bug#78178: 30.1; org-capture-templates datetree does not respect org-blank-before-new-entry

From: Eli Zaretskii <[email-masked]>
Date: Thu, 01 May 2025 20:39:54 +0300

> Date: Wed, 30 Apr 2025 21:40:09 -0400
> From: "critbase" <[email-masked]>
> 
> --text follows this line--
> 
> The relevant parts of my configuration are as follows:
>   (setq org-blank-before-new-entry '((heading . nil)
> 				     (plain-list-item . nil)))
>   (setq org-capture-templates
> 	'(("t" "todo" entry (file+olp+datetree "~/org/superbug.org")
> 	   "* TODO %?\n%U\n%a")
> 	  ("n" "note" entry (file+olp+datetree "~/org/superbug.org")
> 	   "* %?\n%U\n%a")))
> 
> When I capture to a new date, creating the first entry for that day,
> there is a blank line inserted after the deepest datetree headline and
> the headline being captured to, like so:
> 
> * 2025
> ...
> ** 2025-05 May
> *** 2025-05-01 Thursday
> 
> **** TODO Testing date tree
> [2025-05-01 Thu 00:00]
> [[file:~/org/superbug.org::*redacted][redacted]]
> 
> However, when org-blank-before-new-entry is set like so:
>   (setq org-blank-before-new-entry '((heading . auto)
> 				     (plain-list-item . auto)))
> 
> The errant blank line is not created, and the datetree is captured as
> expected:
> 
> * 2025
> ...
> ** 2025-05 May
> *** 2025-05-01 Thursday
> **** TODO Testing date tree
> [2025-05-01 Thu 00:00]
> [[file:~/org/superbug.org::*redacted][redacted]]
> 
> To my understanding, setting heading to nil in the
> org-blank-before-new-entry list should also capture this way.
> 
> Help appreciated.

Thanks, but please report this to the Org developers first.  If they
say this is an issue with Emacs core, please come back here with the
details.