فهرست منبع

org-capture.el: Fix possibly missing final newline

* lisp/org-capture.el (org-capture-finalize): When capturing
an entry, fix missing final newline when the user has deleted
it.

This continues the fix done in d8c51531c.
Bastien 5 سال پیش
والد
کامیت
cb2774d1a8
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      lisp/org-capture.el

+ 10 - 0
lisp/org-capture.el

@@ -728,6 +728,16 @@ captured item after finalizing."
 
   (run-hooks 'org-capture-prepare-finalize-hook)
 
+  ;; Fix missing final newline, as it may have been deleted by accident
+  (when (eq (org-capture-get :type 'local) 'entry)
+    (save-excursion
+      (goto-char (point-max))
+      (and (not (looking-at-p "^"))
+	   (org-with-wide-buffer
+	    (and (not (looking-at-p org-heading-regexp))
+		 (not (eobp))))
+	   (insert "\n"))))
+
   ;; Did we start the clock in this capture buffer?
   (when (and org-capture-clock-was-started
 	     org-clock-marker