소스 검색

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 년 전
부모
커밋
7fbb705d13
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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))