branch: externals-release/org commit 51937d4b13f63927912390c252738436968c554f Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
* 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 <y...@ego.team> 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 94cc5a2288..b635076069 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -6691,6 +6691,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 (point-min) (point-max) ,file))) (or (ignore-errors (funcall ',post-process ,file)) ,file))) @@ -6698,6 +6703,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 (point-min) (point-max) file))) (when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output))