Remove explicit final newlines in Org capture templates

`org-capture-fill-template` unconditionally adds a final newline to each
template.  This caused extra empty lines with the old templates when
nothing is inserted at point (`%?`), because in this case empty lines
before and after point were present, with nothing in between.

Those extra empty lines are gone now, and point is positioned after the
final non-blank character.  When extra empty lines are needed, they have
to be inserted manually.
This commit is contained in:
Daniel - 2024-04-28 19:56:33 +02:00
parent 84b18acc54
commit 85a6366550
Signed by: dbo
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 8 additions and 7 deletions

15
init.el
View File

@ -1104,7 +1104,7 @@
(file db/org-default-refile-file)
,(concat "* TODO [#B] %^{What}\n"
":PROPERTIES:\n:CREATED: %U\n:END:\n"
"\nVia %a.\n\n"
"\nVia %a."
"%?")
:empty-lines-before 1
:empty-lines-after 0)
@ -1112,21 +1112,21 @@
entry
(file db/org-default-refile-file)
,(concat "* %^{Description} (%^{Ticket Number}) :GOAL:\n"
":PROPERTIES:\n:CREATED: %U\n:END:\n"
"\n%?"))
":PROPERTIES:\n:CREATED: %U\n:END:"
"%?"))
("h" "Headline (generic Org item)"
entry
(file db/org-default-refile-file)
,(concat "* [#B] %^{What}\n"
":PROPERTIES:\n:CREATED: %U\n:END:\n"
"%a\n"
"%a"
"%?")
:empty-lines-before 1
:empty-lines-after 0)
("n" "Note"
entry
(file db/org-default-refile-file)
"* Note: %^{About} :NOTE:\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n%?"
"* Note: %^{About} :NOTE:\n:PROPERTIES:\n:CREATED: %U\n:END:%?"
:empty-lines-before 1
:empty-lines-after 0)
("d" "Date"
@ -1140,7 +1140,8 @@
(file db/org-default-refile-file)
,(concat "* DONE [#B] %^{What}\nCLOSED: %U\n"
":PROPERTIES:\n:CREATED: %U\n:END:\n"
"\nInterrupted %(with-temp-buffer (db/org-add-link-to-current-clock) (string-trim (buffer-string)))\n\n%?")
"\nInterrupted %(with-temp-buffer (db/org-add-link-to-current-clock) (string-trim (buffer-string)))."
"%?")
:clock-in t
:clock-resume t
:empty-lines-before 1
@ -1150,7 +1151,7 @@
(file db/org-default-refile-file)
,(concat "* TODO [#B] Reply: %:subject (%:from) :EMAIL:\n"
":PROPERTIES:\n:CREATED: %U\n:END:\n"
"\n%a\n%?")
"\n%a%?")
:empty-lines-before 1
:empty-lines-after 0)))
:config (progn