From 85a63665509e9018565d565f2396c08262b924e3 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 28 Apr 2024 19:56:33 +0200 Subject: [PATCH] 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. --- init.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/init.el b/init.el index e19ab68..9c6405c 100644 --- a/init.el +++ b/init.el @@ -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