Browse Source

org-capture: Do not force newline on empty capture templates

* lisp/org-capture.el (org-capture-fill-template): Do not force
  newline on empty capture templates.

Reported-by: xristos <xristos@sdf.org>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00052.html>
Nicolas Goaziou 7 years ago
parent
commit
7fbb705d13
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lisp/org-capture.el

+ 2 - 2
lisp/org-capture.el

@@ -1763,13 +1763,13 @@ The template may still contain \"%?\" for cursor positioning."
 	       nil t)))))
 
       ;; Make sure there are no empty lines before the text, and that
-      ;; it ends with a newline character.
+      ;; it ends with a newline character or it is empty.
       (skip-chars-forward " \t\n")
       (delete-region (point-min) (line-beginning-position))
       (goto-char (point-max))
       (skip-chars-backward " \t\n")
       (delete-region (point) (point-max))
-      (insert "\n")
+      (unless (bobp) (insert "\n"))
 
       ;; Return the expanded template and kill the capture buffer.
       (untabify (point-min) (point-max))