From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id MKuiIlI1JWV7SAEAauVa8A:P1 (envelope-from ) for ; Tue, 10 Oct 2023 13:28:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MKuiIlI1JWV7SAEAauVa8A (envelope-from ) for ; Tue, 10 Oct 2023 13:28:18 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 229B656ABB for ; Tue, 10 Oct 2023 13:28:18 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=lPLuHlK1; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696937298; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=U1e2EDdgNVnZWoA1C7lC5EVzq83caq6fhlpHPklF3zY=; b=iy/yO7OQo7N+xTo8JdwdyLlGyjy2zrDjlMeg4jrC8z6uxM4IvZ6Mv4f4svPky695XVsvAn DwIboORhM9MwaMhZAXwj0NaEtzTNArVdPgnFc7NSpr4k1c7ub/YLJwCEpa3qW5awCp/bJ6 VCuHHTXEopC1ay/kDHHwe2gQM1v4eXL5ZnrGrmIs5HallpJUQb5KKBYiMzr7E2mLH3J7EV AeHirKv5qejZAEVlzAUznZU+n+l2nC1g0Oq1U/hWJ6etzKYDeqt4m9hJt/SV67DlXqIrcM NGm0c8hzanS8hfcKnRlldRebiv8m10AkakkNsuH/C/w8ODjyYmdBLpNd0rze5A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=lPLuHlK1; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696937298; a=rsa-sha256; cv=none; b=eb0SgzulocNZJ9EDiCSndof3OV0zB0Zf68hrrpLCJuQNjpPTGBdwPDOu2BBfLA5QsU25/4 lR0ZyPtkhPpI52bkBBWJSRiYo/GvzMmd8iilqzLmLNlM9YX4JskDa59eZB7gfikYwU55JP G2BwBF3QEeFGOpK00uRmMW884jvLj7PjWkJgh3wLkbTR9pqdDlzKeiyf5c8KooCElsCtCo iAufIkEvFN6covD02Bd/nTVg2F7lxhVW31iWuVIRWlFMuYorTqkrBtBBf7vCy5G8X9LHTP VdYqoIkb8HompCdgIDakKIANNCBQ7MqMusJ1zYR1CTN/h+UB+Z51FOCfLh76+Q== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqAmt-0007RI-HG; Tue, 10 Oct 2023 07:20:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqAmr-0007Qo-8c for emacs-orgmode@gnu.org; Tue, 10 Oct 2023 07:20:29 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqAmo-0006ct-PG for emacs-orgmode@gnu.org; Tue, 10 Oct 2023 07:20:29 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 7C743240028 for ; Tue, 10 Oct 2023 13:20:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1696936823; bh=b/GkJGYe6E+adkb0CXocyGED8tChF8Fp01+QOvfcQE4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=lPLuHlK1DvAo+4VXJhLJGrFC09qPg6m7ApPiVMD5X0eVcJxZ2g+RTj8xAiYnlUSHW soJXiY3KFQ/dHfezyVhJcN5MKc16Qj7nTSUBSDvI9oasqsoqOJEY8IXMiM+64XIaTX QMdvxPEjPgnaONQuCcbAV31m+CG22UJuCo5b8IvnavLN0byKxuECBINEuZFiPGp9lD eo4Rg+Gk267nHSF8PT47oEpAfe5HYUExUbYOqt0rkjFSORdKsoRBEbTq5kjZd5JvUa hcxLad1erSjubylHtvKGEwdwDLl+YsX0kTw7lLA1nRL/YlxcbcvD8t5M5KnPuQHt4c RE2tMAHrtxsPg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4S4YNQ3tQNz6v8q; Tue, 10 Oct 2023 13:20:22 +0200 (CEST) From: Ihor Radchenko To: Bruno Barbier Cc: YE , Max Nikulin , 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/)] In-Reply-To: <87wmvwklnq.fsf@localhost> References: <877cny25x4.fsf@localhost> <6523f0cd.5d0a0220.2bb6e.3bfc@mx.google.com> <87wmvwklnq.fsf@localhost> Date: Tue, 10 Oct 2023 11:21:51 +0000 Message-ID: <87lecaafjk.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -7.87 X-Spam-Score: -7.87 X-Migadu-Queue-Id: 229B656ABB X-Migadu-Scanner: mx2.migadu.com X-TUID: 31gpT+Ywm4GV --=-=-= Content-Type: text/plain Ihor Radchenko writes: > AFAIU, `require-final-newline' is t by default, except binary data. > Also, Org export is not designed to generate binary output. > So, it should be OK to ensure the final newline manually, in > `org-export-to-file' - to minimize possible breakage. See the attached tentative patch. I am not merging it yet upstream (onto bugfix) in case if there are objections. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-lisp-ox.el-org-export-to-file-Ensure-final-newline.patch >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 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--