branch: externals/org
commit 7d905074205929537b9a9d25127d8c3dc3a3f20f
Merge: 9fcbd19b3b 51937d4b13
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    Merge branch 'bugfix'
---
 lisp/ox.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lisp/ox.el b/lisp/ox.el
index 8df160488d..a54456893f 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -6776,6 +6776,11 @@ or FILE."
                     ',ext-plist)))
               (with-temp-buffer
                 (insert output)
+                 ;; Ensure final newline.  This is what was done
+                 ;; historically, when we used `write-file'.
+                 ;; Note that adding a newline is only safe for
+                 ;; non-binary data.
+                 (unless (bolp) (insert "\n"))
                 (let ((coding-system-for-write ',encoding))
                   (write-region nil nil ,file)))
               (or (ignore-errors (funcall ',post-process ,file)) ,file)))
@@ -6783,6 +6788,11 @@ or FILE."
                        backend subtreep visible-only body-only ext-plist)))
           (with-temp-buffer
             (insert output)
+            ;; Ensure final newline.  This is what was done
+            ;; historically, when we used `write-file'.
+            ;; Note that adding a newline is only safe for
+            ;; non-binary data.
+            (unless (bolp) (insert "\n"))
             (let ((coding-system-for-write encoding))
              (write-region nil nil file)))
           (when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p 
output))

Reply via email to