summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-06-19 16:38:09 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-06-19 16:38:09 +0200
commit7fbb705d13fd5c2923b56618335733532c95f692 (patch)
treef3584632c3612eb2fc28ebcfaef7ac9c53ab2390
parent075e79de4fb372027137297ec0505c6b5caec011 (diff)
downloadorg-mode-7fbb705d13fd5c2923b56618335733532c95f692.tar.gz
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>
-rw-r--r--lisp/org-capture.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index df91cb4..8d71c79 100644
--- a/lisp/org-capture.el
+++ b/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))