From 5bfe7dd32fb10af0540b271d1de27849507cb6d3 Mon Sep 17 00:00:00 2001 Message-ID: <5bfe7dd32fb10af0540b271d1de27849507cb6d3.1696936855.git.yantar92@posteo.net> From: Ihor Radchenko Date: Tue, 10 Oct 2023 14:19:53 +0300 Subject: [PATCH] * lisp/ox.el (org-export-to-file): Ensure final newline The newline were added by default in the past, before d7a55bbd5. Continue to add it to avoid changed behavior. Reported-by: YE Link: https://orgmode.org/list/87wmvwklnq.fsf@localhost --- lisp/ox.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lisp/ox.el b/lisp/ox.el index 94cc5a228..b63507606 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -6691,6 +6691,11 @@ (defun org-latex-export-to-latex ',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 (point-min) (point-max) ,file))) (or (ignore-errors (funcall ',post-process ,file)) ,file))) @@ -6698,6 +6703,11 @@ (defun org-latex-export-to-latex 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 (point-min) (point-max) file))) (when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output)) -- 2.42.0