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>
This commit is contained in:
Nicolas Goaziou 2018-06-19 16:38:09 +02:00
parent 075e79de4f
commit 7fbb705d13

View file

@ -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))