Hi Ye, Ihor, Max,

The change seems to come from this commit:

   commit d7a55bbd537314d2776b082bd92a1a08b3edc84e
   Date:   Wed Sep 28 12:07:14 2022 +0800
   org-latex-export-to-latex: Do not suppress major modes in babel

It replaces 'write-file' with 'write-region', but, according to the
documentation of 'require-final-newline', 'write-region' ignores
'require-final-newline'.

See attached diff that reverts the problematic change.

In summary, before this commit, Emacs was fixing exported text files
(HTML, markdown, etc.) for free, adding a newline if needed for text
files.  It's not anymore.  I'm not sure what would be the best way to
fix this though.



Bruno

diff --git a/lisp/ox.el b/lisp/ox.el
index f8ccd2a9f..5ff105d3b 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -6893,7 +6893,7 @@ (defun org-export-to-file
           (with-temp-buffer
             (insert output)
             (let ((coding-system-for-write encoding))
-	      (write-region nil nil file)))
+	      (write-file file)))
           (when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p output))
             (org-kill-new output))
           ;; Get proper return value.

Reply via email to