emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bruno Barbier <brubar.cs@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>, YE <yet@ego.team>,
	Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]
Date: Mon, 09 Oct 2023 14:23:39 +0200	[thread overview]
Message-ID: <6523f0cd.5d0a0220.2bb6e.3bfc@mx.google.com> (raw)
In-Reply-To: <877cny25x4.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 676 bytes --]


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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Revert bug --]
[-- Type: text/x-patch, Size: 489 bytes --]

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.

  parent reply	other threads:[~2023-10-09 12:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 15:53 [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)] YE
2023-10-07  8:27 ` Ihor Radchenko
2023-10-08 19:40   ` YE
2023-10-09 11:29     ` Ihor Radchenko
2023-10-09 11:41       ` Max Nikulin
2023-10-09 11:46         ` Ihor Radchenko
2023-10-09 11:53           ` Max Nikulin
2023-10-09 12:06             ` Ihor Radchenko
2023-10-09 12:23   ` Bruno Barbier [this message]
2023-10-09 12:47     ` Ihor Radchenko
2023-10-10 11:21       ` Ihor Radchenko
2023-10-11  8:10         ` YE
2023-10-15  8:14           ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6523f0cd.5d0a0220.2bb6e.3bfc@mx.google.com \
    --to=brubar.cs@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    --cc=yantar92@posteo.net \
    --cc=yet@ego.team \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).