Hello,
When org-odd-levels-only is non-nil, a capture template using
file+olp+datetree creates the year heading two stars too deep, and the
month, day and entry headings follow from that wrong level.
Environment:
- Org version: 9.8.7
- Emacs version: GNU Emacs 31.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.52, cairo version 1.18.4)
- OS: Linux xxx 6.18.58.1-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC
Tue Oct 27 00:24:11 UTC 2026 x86_64 GNU/Linux
Steps to reproduce (emacs -q):
1. Create a file tmp.org containing only:
* Diary
2. Evaluate:
(setq org-odd-levels-only t)
(setq org-capture-templates
'(("d" "Diary entry (date-based)" entry
(file+olp+datetree "/path/to/tmp.org" "Diary")
"* %? %i")))
3. Run M-x org-capture, choose "d", type "foo bar", and finish with C-c C-c.
Actual result:
* Diary
***** 2026
******* 2026-11 November
********* 2026-11-18 Wednesday
*********** foo bar
Expected result (odd levels only, so each level is two stars deeper):
* Diary
*** 2026
***** 2026-11 November
******* 2026-11-18 Wednesday
********* foo bar <2026-11-18 Wed 08:44>
The year heading is two stars deeper than expected, and everything below it
is shifted by the same amount. The month, day and entry headings are
correctly spaced relative to the year. The same configuration without
org-odd-levels-only produces correct levels.
I have not yet checked whether this is already fixed in a newer Org release.
Thank you