From unknown Mon Jun 23 18:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72870: [PATCH] Flow fill texts after the last hard newline Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Aug 2024 10:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72870 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 72870@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172492909512239 (code B ref -1); Thu, 29 Aug 2024 10:59:01 +0000 Received: (at submit) by debbugs.gnu.org; 29 Aug 2024 10:58:15 +0000 Received: from localhost ([127.0.0.1]:50551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sjcqz-0003BJ-JA for submit@debbugs.gnu.org; Thu, 29 Aug 2024 06:58:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:60700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sjcew-0002mU-DE for submit@debbugs.gnu.org; Thu, 29 Aug 2024 06:45:47 -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 1sjce2-0006b4-S7 for bug-gnu-emacs@gnu.org; Thu, 29 Aug 2024 06:44:50 -0400 Received: from fout1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sjce0-0005B6-Fx for bug-gnu-emacs@gnu.org; Thu, 29 Aug 2024 06:44:50 -0400 Received: from phl-compute-05.internal (phl-compute-05.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 65881138FFC6 for ; Thu, 29 Aug 2024 06:44:46 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Thu, 29 Aug 2024 06:44:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1724928286; x=1725014686; bh=FnX77ffryrLzGWyxnttayUAqQuoF4YSO bJLp02Emj8I=; b=LTu35bd8OlHRmlXqY0CgFGzyOr/6lBILDmvYJ2jK8IIeWyZW aj2Iy7BETesjr0Buk3JJe6d+tfoYQwPy7CVb7/Rib6a/o3nKndOk3oJPxyfVnjNf 0ur4no9JMWIPpGifvBRWghs6MwJ7HniM1+kOUE/4C6wbExW8ItnANT8jQsAIhqiE TAG/gqQVD2ycnJu19k2uOuy+Vf/75PngvA7ZBiUJJwtgp316VUKRruCyvkr3xiqa E3xhueDWDelbvgGsQxFCEO9l2FgIpZohXD8nSwsuf/HWtZDbzna8m3ryI02lwpLk K3yvSziyHGVTtJnh4nMjCOPsu3xWcnURWripaQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1724928286; x=1725014686; bh=FnX77ffryrLzGWyxnttayUAqQuoF4YSObJL p02Emj8I=; b=RiKw/mBY0G0kMQCMMvroIBqV2q3rzdDJXg+Pnqk/FUOpp/ic3Kw mH2GD8ixL7QRPCP5AcNDJ1s1DhIYfFppOdi9agw8WSiJj2gl6XkaUl3Gl0w6BJt1 00c7gzzX5DNIPWYSIyIMPgPVn98emSmSrSjuJrDfGIP6xJ6UZQyPy+NNF6eUSPAF qkuwgzukRruXm07D0j0rUvGthnXLGfgi2bdGB5yOv6vvKeQtJ4SAnt2ZMmbSwFHa 8/XyOueR1ipoBbZGMsPP9ysFoQBgP+lV5r4C1tuJbJz9buAX9EJHo0XJJGbM5WGh TYsBvsaY05kVyCSEcZY6vFCzcF4irNK7M1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudefgedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkgggtsehmtderredttddtnecuhfhrohhmpefrvghnghhjihcukghhrghnghcuoehmvges phgvnhhgjhhiiidrtghomheqnecuggftrfgrthhtvghrnhepfffgiefhgfduleelvdeiie dtvdefieegkedtkefftdeljefgheelvdffjeegteegnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepmhgvsehpvghnghhjihiirdgtohhmpdhnsg gprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegsuhhgqdhg nhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 29 Aug 2024 06:44:45 -0400 (EDT) From: Pengji Zhang Date: Thu, 29 Aug 2024 18:44:36 +0800 Message-ID: <87cylr7gmj.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.144; envelope-from=me@pengjiz.com; helo=fout1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Mailman-Approved-At: Thu, 29 Aug 2024 06:58:12 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain; format=flowed Tags: patch Hello! I found that function `fill-flowed-encode' would not fill texts after the last hard newline in a buffer. To reproduce, run 'emacs -Q' and then evaluate the following snippet: --8<---------------cut here---------------start------------->8--- (with-current-buffer (get-buffer-create "*tmp-f=f*") (use-hard-newlines) (insert "1\n2") (fill-flowed-encode) (display-buffer (current-buffer))) --8<---------------cut here---------------end--------------->8--- The expected output should be '1 2', but the actual is '1\n2'. The first patch changes this. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Flow-fill-texts-after-the-last-hard-newline.patch >From 9320c59a212459181f81025e9895e9172dde1361 Mon Sep 17 00:00:00 2001 From: Pengji Zhang Date: Wed, 28 Aug 2024 18:57:35 +0800 Subject: [PATCH 1/2] Flow fill texts after the last hard newline * lisp/mail/flow-fill.el (fill-flowed-encode): Use `(point-max)' as `end' if there are no remaining hard newlines in buffer. This ensures that the last paragraph will always be encoded, even without a trailing hard newline. --- lisp/mail/flow-fill.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el index 919490ec5aa..d4ad7d45982 100644 --- a/lisp/mail/flow-fill.el +++ b/lisp/mail/flow-fill.el @@ -78,7 +78,9 @@ fill-flowed-encode (let ((start (point-min)) end) ;; Go through each paragraph, filling it and adding SPC ;; as the last character on each line. - (while (setq end (text-property-any start (point-max) 'hard 't)) + (while (and (< start (point-max)) + (setq end (or (text-property-any start (point-max) 'hard 't) + (point-max)))) (save-restriction (narrow-to-region start end) (let ((fill-column (eval fill-flowed-encode-column t))) -- 2.46.0 --=-=-= Content-Type: text/plain; format=flowed Besides, I found that the test case 'fill-flow-tests-fill-flowed-encode' in 'fill-flow-tests' does not actually test the function 'fill-flowed-encode', which requires 'use-hard-newlines'[1], and the test input does not cover some behaviors of the function. The second patch improves it a bit. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Improve-tests-for-flow-fill.patch >From 649509a3ce4fbc773ed9490b1dd214f1c18dea1e Mon Sep 17 00:00:00 2001 From: Pengji Zhang Date: Wed, 28 Aug 2024 19:11:35 +0800 Subject: [PATCH 2/2] Improve tests for flow-fill * test/lisp/mail/flow-fill-tests.el (fill-flow-tests-fill-flowed-decode): Remove debug message. (fill-flow-tests-fill-flowed-encode): Actually test function `fill-flowed-encode', which requires `use-hard-newline' to be non-nil. Also adjust test input to check behaviors of the function under different cases. --- test/lisp/mail/flow-fill-tests.el | 42 ++++++++++++++++++------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/test/lisp/mail/flow-fill-tests.el b/test/lisp/mail/flow-fill-tests.el index 1f698f538f3..50fbb1e7f80 100644 --- a/test/lisp/mail/flow-fill-tests.el +++ b/test/lisp/mail/flow-fill-tests.el @@ -54,37 +54,43 @@ fill-flow-tests-fill-flowed-decode (with-temp-buffer (insert input) (fill-flowed) - (message "foo") (should (equal (buffer-string) output))))) (ert-deftest fill-flow-tests-fill-flowed-encode () (let ((input (concat - "> Thou villainous ill-breeding spongy dizzy-eyed \n" - "> reeky elf-skinned pigeon-egg! \n" - ">> Thou artless swag-bellied milk-livered \n" - ">> dismal-dreaming idle-headed scut!\n" + ;; Hard newline in the middle of a level + "> Thou villainous ill-breeding spongy dizzy-eyed" hard-newline + "> reeky elf-skinned pigeon-egg!\n" + ">> Thou artless swag-bellied milk-livered\n" + ;; Hard new line at the end of a level + ">> dismal-dreaming idle-headed scut!" hard-newline + ;; Trailing space should be preserved after filling ">>> Thou errant folly-fallen spleeny reeling-ripe \n" ">>> unmuzzled ratsbane!\n" - ">>>> Henceforth, the coding style is to be strictly \n" + ">>>> Henceforth, the coding style is to be strictly\n" ">>>> enforced, including the use of only upper case.\n" - ">>>>> I've noticed a lack of adherence to the coding \n" + ;; Consecutive hard newlines within a level + ">>>>> I've noticed a lack of adherence to" hard-newline + ">>>>> the coding" hard-newline ">>>>> styles, of late.\n" ">>>>>> Any complaints?\n")) (output (concat - "> Thou villainous ill-breeding spongy dizzy-eyed \n" + "> Thou villainous ill-breeding spongy dizzy-eyed\n" "> reeky elf-skinned pigeon-egg! \n" - ">> Thou artless swag-bellied milk-livered \n" - ">> dismal-dreaming idle-headed scut!\n" - ">>> Thou errant folly-fallen spleeny reeling-ripe \n" - ">>> unmuzzled ratsbane!\n" - ">>>> Henceforth, the coding style is to be strictly \n" - ">>>> enforced, including the use of only upper case.\n" - ">>>>> I've noticed a lack of adherence to the coding \n" - ">>>>> styles, of late.\n" - ">>>>>> Any complaints?\n")) - (fill-flowed-display-column 69)) + ">> Thou artless swag-bellied milk-livered dismal-dreaming \n" + ">> idle-headed scut!\n" + ">>> Thou errant folly-fallen spleeny reeling-ripe unmuzzled \n" + ">>> ratsbane! \n" + ">>>> Henceforth, the coding style is to be strictly enforced, \n" + ">>>> including the use of only upper case. \n" + ">>>>> I've noticed a lack of adherence to\n" + ">>>>> the coding\n" + ">>>>> styles, of late. \n" + ">>>>>> Any complaints? \n")) + (use-hard-newlines t) + (fill-flowed-encode-column 66)) (with-temp-buffer (insert input) (fill-flowed-encode) -- 2.46.0 --=-=-= Content-Type: text/plain; format=flowed The second patch depends on the first one, without which the new test will fail. So I decided to submit both together. Please let me know if it is better to file another report. Thanks! Cheers, Pengji PS I have sent an email to assign@gnu.org, but have not got a response yet. I think I have not finished the copyright assignment process? [1] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/mail/flow-fill.el#n77 --=-=-=-- From unknown Mon Jun 23 18:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72870: [PATCH] Flow fill texts after the last hard newline Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Sep 2024 07:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72870 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Pengji Zhang Cc: 72870@debbugs.gnu.org Received: via spool by 72870-submit@debbugs.gnu.org id=B72870.17256955128694 (code B ref 72870); Sat, 07 Sep 2024 07:52:02 +0000 Received: (at 72870) by debbugs.gnu.org; 7 Sep 2024 07:51:52 +0000 Received: from localhost ([127.0.0.1]:54741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smqEZ-0002G9-Hi for submit@debbugs.gnu.org; Sat, 07 Sep 2024 03:51:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42524) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smqEX-0002Fx-QI for 72870@debbugs.gnu.org; Sat, 07 Sep 2024 03:51:50 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smqER-00013K-OM; Sat, 07 Sep 2024 03:51:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=O+ZpYaK9EqeT+BlO6xjuF5l9euqE6Ned8Sabyv6xBQ8=; b=DcuAX18zLvBX K8gwHpU8X/iSarJqi29/8CXTCaxIflaTDtJ/ITY9ZX4j0h+RjxscgFrtA+hI5QO1e+0pzE4JA6N4U Qmwx5prdhLoXtSWdMh09N1FxQov7DtBU94wyo4k0EQ62fDwxOrKGMIpqwPw0tG3mn2qrmf9LJ7O8i QSq5IkD+gW8JI8mC+gtvopJsuRpyjsiYi7o61GZz6ilu8rh7atLM+vD1yHtXOrrQMzf0qoJyMraek Pq7YOikWL9ti/pFaTXJDuXNpsLj67wnJ4ysXK5ogwxZtlzT4S1WIDZiKcm+GMIMpwVbCZuT7SyTIF WFtJcD49Wh9c9VWEe9pk4A==; Date: Sat, 07 Sep 2024 10:51:42 +0300 Message-Id: <867cbnzysx.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87cylr7gmj.fsf@pengjiz.com> (message from Pengji Zhang on Thu, 29 Aug 2024 18:44:36 +0800) References: <87cylr7gmj.fsf@pengjiz.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Pengji Zhang > Date: Thu, 29 Aug 2024 18:44:36 +0800 > > I found that function `fill-flowed-encode' would not fill texts > after the last hard newline in a buffer. To reproduce, run 'emacs > -Q' and then evaluate the following snippet: > > --8<---------------cut here---------------start------------->8--- > (with-current-buffer (get-buffer-create "*tmp-f=f*") > (use-hard-newlines) > (insert "1\n2") > (fill-flowed-encode) > (display-buffer (current-buffer))) > --8<---------------cut here---------------end--------------->8--- > > The expected output should be '1 2', but the actual is '1\n2'. > > The first patch changes this. > > Besides, I found that the test case > 'fill-flow-tests-fill-flowed-encode' in 'fill-flow-tests' does not > actually test the function 'fill-flowed-encode', which requires > 'use-hard-newlines'[1], and the test input does not cover some > behaviors of the function. The second patch improves it a bit. > > The second patch depends on the first one, without which the new > test will fail. So I decided to submit both together. Please let > me know if it is better to file another report. Thanks. AFAICT, this function exists for the special case of decoding email messages. Can email messages have flowed-encoded text without a hard newline at the end? > PS I have sent an email to assign@gnu.org, but have not got a > response yet. I think I have not finished the copyright assignment > process? No. Please ping them and CC me, so we could get your paperwork process going. From unknown Mon Jun 23 18:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72870: [PATCH] Flow fill texts after the last hard newline Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Sep 2024 14:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72870 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 72870@debbugs.gnu.org Received: via spool by 72870-submit@debbugs.gnu.org id=B72870.1725806278738 (code B ref 72870); Sun, 08 Sep 2024 14:38:01 +0000 Received: (at 72870) by debbugs.gnu.org; 8 Sep 2024 14:37:58 +0000 Received: from localhost ([127.0.0.1]:59810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snJ37-0000Bp-GB for submit@debbugs.gnu.org; Sun, 08 Sep 2024 10:37:58 -0400 Received: from fout7-smtp.messagingengine.com ([103.168.172.150]:48013) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snGXE-0008II-MH for 72870@debbugs.gnu.org; Sun, 08 Sep 2024 07:56:53 -0400 Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 63059138032C; Sun, 8 Sep 2024 07:56:45 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Sun, 08 Sep 2024 07:56:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1725796605; x=1725883005; bh=njeACU/Ori wKYeCVleo449r4QAG7qQ+6MEigX3vr5xw=; b=eaR+0SKueRrs0wd0Edb3q3UPeo gMQlbUSsgJAD1cBkgO6lFA84MIAHI0LqZk4R26rd7uLRXc6h6lLewSXTKomJEPv6 hrjbF6NCLNLlQIhjydmyeLQGdxZev6e3ovjo0+5Z/jTX7sb/Vbq4xUwFkeIwEenf jtnbmCCqFQliJbd4DJCWBsgZqJkp/EcpaGRszpBDZ//YZF/M2FFYqORwLioaUXLx LpJRPO+CvImz3+78rqhHWPXVO+1fYHRNcq8awxd+PhBecKdk/4+oV62jAw2D6eNm iAAR8N2OCXYKzScpldE6XhTjaM7QNBrs7WCju2JdN5iS6h25ztsTkGlgZtFg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1725796605; x=1725883005; bh=njeACU/OriwKYeCVleo449r4QAG7 qQ+6MEigX3vr5xw=; b=eechVoUyeyevsZJ2eGhQAek4PGYu1665wpu6PYKp53j1 7LkINum2KIaytVR7av+gGmWqZWH+N6WrvM+bhufqnFPsX+aO6cx/juLPRFegioxl Q11fG3pYce3dQggHQBtf8HdUnmjTOHuB5Ja5umlCEm5StYopeaEA2lqI+tbuUU2H THMjstyaTDvxCM5wXTDWVdyLq62V+vlp94CfZ5VG97Qbr2PE1lz0////592UEP3i IcLsh+VIeo1mB+agML9uZVZEKtCNP+6B30lhCH/WztjrSJb9kPyPtWMM3WeBhzkb PCirKP+rTfmiQEF4YwBjhi4oAYKFWELfOt9lMn9IOQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeihedggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehttdertddttddtnecu hfhrohhmpefrvghnghhjihcukghhrghnghcuoehmvgesphgvnhhgjhhiiidrtghomheqne cuggftrfgrthhtvghrnhepkeehjeeihfeigefghfduvdfgjeeljeffudeiheekheefffeh udeutddvjefgheetnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgvsehpvghnghhjihiirdgtohhm pdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegvlh hiiiesghhnuhdrohhrghdprhgtphhtthhopeejvdekjedtseguvggssghughhsrdhgnhhu rdhorhhg X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 8 Sep 2024 07:56:43 -0400 (EDT) From: Pengji Zhang In-Reply-To: <867cbnzysx.fsf@gnu.org> References: <87cylr7gmj.fsf@pengjiz.com> <867cbnzysx.fsf@gnu.org> Date: Sun, 08 Sep 2024 19:56:28 +0800 Message-ID: <878qw2uzo3.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Score: -0.7 (/) X-Mailman-Approved-At: Sun, 08 Sep 2024 10:37:56 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: > AFAICT, this function exists for the special case of decoding > email messages. Can email messages have flowed-encoded text > without a hard newline at the end? I think you meant "encoding"? Anyway, if I understand it correctly, an email message should always end with a newline, but it is not necessarily a hard newline. For example, 'message.el' inserts a normal newline: https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/gnus/message.el#n4944 I am not sure what other MUAs do, though. >> PS I have sent an email to assign@gnu.org, but have not got a >> response yet. I think I have not finished the copyright >> assignment process? > > No. Please ping them and CC me, so we could get your paperwork > process going. Will do. Thanks! Pengji From unknown Mon Jun 23 18:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72870: [PATCH] Flow fill texts after the last hard newline Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Sep 2024 04:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72870 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 72870@debbugs.gnu.org Received: via spool by 72870-submit@debbugs.gnu.org id=B72870.17258546683082 (code B ref 72870); Mon, 09 Sep 2024 04:05:02 +0000 Received: (at 72870) by debbugs.gnu.org; 9 Sep 2024 04:04:28 +0000 Received: from localhost ([127.0.0.1]:60426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snVdc-0000nd-AR for submit@debbugs.gnu.org; Mon, 09 Sep 2024 00:04:28 -0400 Received: from fhigh5-smtp.messagingengine.com ([103.168.172.156]:51347) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snVda-0000nK-39 for 72870@debbugs.gnu.org; Mon, 09 Sep 2024 00:04:26 -0400 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id A4C191140173; Mon, 9 Sep 2024 00:04:17 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Mon, 09 Sep 2024 00:04:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1725854657; x=1725941057; bh=VR6cUnKFtw IxDxjluOzkv+y9RBhpB/UDxmzy9yeQahM=; b=kyFiJ02VW1Upgt7cctdA4edbNI Vu1AjxR/rl8EsKuwX/3B05w1E43zL2VGq6aSn6JY5XakKbpusrkQOX0KNomyAT+S gtA/NFA73RiNMO9Lkr2DSXV1wJdK3QEABXmQNIMzxK+v0taervR2zPiBY7qfkJ/g ut0EPRMZ3M74BOijNI3XsfAy41bPFBsemg4nw3/5SvxfYefDaQmH0D92earkyLlR Hy66zh43hpC1yMhMLb/kwOChOtrd0FuWKoLIJ+9aZwc1OU+DBqtIp2HZOfzgIUrn GpFeYurL+sKxP81+pUnCyqLGz2OYcjCUnQOaChXCp5+2LjC22xJEfXdJuAKg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1725854657; x=1725941057; bh=VR6cUnKFtwIxDxjluOzkv+y9RBhp B/UDxmzy9yeQahM=; b=nl5BCZHqeOP4okuVwgw2UFIhwJpNQN78B93TsSZhC9kO C9k0taIogxJ0+cJu+TJT/Hu9F4+/pKt5RaGM1LOSAQn1PWtuQu1hOlv5O+Iu8NOu HUDncAJZIu/17sfGxBrxuKMrrp7ph8eAO/um/4gusy7hQLArS0ZJkWZTsPmR9ezl SnUX5jWkwW7Xh4GJsVnF7+XPbB5N86714ATKZ+Q3xibIodpZycVfG/9BtWX4Whmp Jzbq1HARHDiyFWGWjx333WVtJkeXWpoLCORBwM+z0dbcEDsRt1GFgDEGrA/K55PL YAOubejBVslcWLI7wy487dFHtegOpXkfNnnZe8jzTQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeiiedgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehttdertddttddtnecu hfhrohhmpefrvghnghhjihcukghhrghnghcuoehmvgesphgvnhhgjhhiiidrtghomheqne cuggftrfgrthhtvghrnhepkeehjeeihfeigefghfduvdfgjeeljeffudeiheekheefffeh udeutddvjefgheetnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgvsehpvghnghhjihiirdgtohhm pdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegvlh hiiiesghhnuhdrohhrghdprhgtphhtthhopeejvdekjedtseguvggssghughhsrdhgnhhu rdhorhhg X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Sep 2024 00:04:16 -0400 (EDT) From: Pengji Zhang In-Reply-To: <878qw2uzo3.fsf@pengjiz.com> References: <87cylr7gmj.fsf@pengjiz.com> <867cbnzysx.fsf@gnu.org> <878qw2uzo3.fsf@pengjiz.com> Date: Mon, 09 Sep 2024 12:04:02 +0800 Message-ID: <877cblcw25.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Pengji Zhang writes: > Eli Zaretskii writes: > >> AFAICT, this function exists for the special case of decoding >> email messages. Can email messages have flowed-encoded text >> without a hard newline at the end? > > I think you meant "encoding"? Anyway, if I understand it > correctly, an email message should always end with a newline, > but it is not necessarily a hard newline. For example, > 'message.el' inserts a normal newline: > > https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/gnus/message.el#n4944 I just realized this insertion of newline happens after encoding, so this is irrelevant here. Sorry. It seems that during encoding, no such a newline is added at all. To reproduce: - Run 'emacs -Q' - C-x m C-c C-b - M-x use-hard-newlines RET n - C-x f 10 RET - Eval: (dotimes (i 10) (insert "word ")) - RET RET - Eval: (dotimes (i 10) (insert "word ")) - M-q - C-u M-x mml-preview RET In the preview buffer, the first paragraph is filled but the second is not. From unknown Mon Jun 23 18:30:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72870: [PATCH] Flow fill texts after the last hard newline Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Oct 2024 09:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72870 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 72870@debbugs.gnu.org Received: via spool by 72870-submit@debbugs.gnu.org id=B72870.17284645768415 (code B ref 72870); Wed, 09 Oct 2024 09:03:02 +0000 Received: (at 72870) by debbugs.gnu.org; 9 Oct 2024 09:02:56 +0000 Received: from localhost ([127.0.0.1]:55624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sySau-0002Bf-19 for submit@debbugs.gnu.org; Wed, 09 Oct 2024 05:02:56 -0400 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]:57919) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sySas-0002BR-4z for 72870@debbugs.gnu.org; Wed, 09 Oct 2024 05:02:55 -0400 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3DB7611402CE; Wed, 9 Oct 2024 05:02:39 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 09 Oct 2024 05:02:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1728464559; x=1728550959; bh=3xHM3mrqHS YYUqptxaqMHSTY+6NseYj1gwb9PgRJ+Ig=; b=VHGDR5C3M7mCTDsVMfCUYEbOgG K1y8g9OnSvbFFairZjatHjvbRrqYMIzPN6P4Ne2hbiLUKBHtAAI1B4mEtgXMxYP8 yCxURcRA/kTkfooCMWO1ilHlJBP5UgowGqaFJaqePWFs758tnNbzSOSX7zEvEsib F2nZLV5yNzF547q/aIAR+tQiwhK+t7JXcbC7Y52mNNx0VsSoUGAuTIw6R6Mig7t1 Z3KoBXej6F8TLkwc1oENMPwRwk2M+/6Q1EQjA3I1usR0njIJxwILLGHT7t8SgLyQ xDqfHXDZZc5mFuoLzmcBhCPLoU0bp1ge/rr5kIdEr9jf3+dYmgKEHqg09AFA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728464559; x=1728550959; bh=3xHM3mrqHSYYUqptxaqMHSTY+6Ns eYj1gwb9PgRJ+Ig=; b=Pp29/dwESf4a4DS3hP+WnuLtw6IWXQ1EV3US99/MTGI2 jRD5kaX27Fidcs5V1ADz1wJR36dPOY9dBIzUzfk6j2TDGrSQwadtuZzYhwMnFeGI QapsoSAnYmQ94DN4i+H913fMxauBMo23zkDTt0ud+JWePdrXrnnMx3tdQwvauX7S zbNldnpNik9KPEvvSyQ7Ysmg/ZkRIWjXPC1lSxO/rHCEBJhCNpI+Q9O8f91ljn+k CNUk1sICJQFgghYKjnNHxA6H+oiMx6yBRt4CCuCd1awEeJFM5bL7ma2zUWbuLqt0 veezHob/iX4iPmXQ0Ia92hv9eOTfS/3NzrOwNOHt8g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehttdertddttddtnecu hfhrohhmpefrvghnghhjihcukghhrghnghcuoehmvgesphgvnhhgjhhiiidrtghomheqne cuggftrfgrthhtvghrnhepgeefieeivddukeeitdegudeftdevtdeuteeifffhvdehffet gfeijeeileelheegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepmhgvsehpvghnghhjihiirdgtohhmpdhnsggprhgtphhtthhopedvpdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtth hopeejvdekjedtseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 05:02:37 -0400 (EDT) From: Pengji Zhang In-Reply-To: <867cbnzysx.fsf@gnu.org> References: <87cylr7gmj.fsf@pengjiz.com> <867cbnzysx.fsf@gnu.org> Date: Wed, 09 Oct 2024 17:02:32 +0800 Message-ID: <87bjztvec7.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: >> PS I have sent an email to assign@gnu.org, but have not got a >> response yet. I think I have not finished the copyright assignment >> process? > > No. Please ping them and CC me, so we could get your paperwork process > going. Hi Eli! Yesterday I was told that my assignment process had been complete. From unknown Mon Jun 23 18:30:33 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Pengji Zhang Subject: bug#72870: closed (Re: bug#72870: [PATCH] Flow fill texts after the last hard newline) Message-ID: References: <86frp1wli2.fsf@gnu.org> <87cylr7gmj.fsf@pengjiz.com> X-Gnu-PR-Message: they-closed 72870 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 72870@debbugs.gnu.org Date: Sat, 12 Oct 2024 12:32:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1728736322-12844-1" This is a multi-part message in MIME format... ------------=_1728736322-12844-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #72870: [PATCH] Flow fill texts after the last hard newline which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 72870@debbugs.gnu.org. --=20 72870: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D72870 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1728736322-12844-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 72870-done) by debbugs.gnu.org; 12 Oct 2024 12:31:59 +0000 Received: from localhost ([127.0.0.1]:41356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szbHr-0003Kw-Fz for submit@debbugs.gnu.org; Sat, 12 Oct 2024 08:31:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41220) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szbHp-0003Ke-IP for 72870-done@debbugs.gnu.org; Sat, 12 Oct 2024 08:31:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1szbHV-0004Y1-RM; Sat, 12 Oct 2024 08:31:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JxsdWjFZJei+CfkaiKVjsVh1F/Drs/GXSC5iGrDeQWs=; b=FEGPYydIoFum pL5YW069PL4Vqr9LEiHMjxw+Gnw9jRGfgQKbCdDxXKZ7JAgLvADurA1Q2Qc5x+W3041a6pATxMGFU 0rpzkrSr8MR+ELXHd7WiCxwCZ9+jmu7ZyLItAKSpbDCu1EcFG/VY6/vusXXMn9ephDVa7jeqGpyRS exQk+P0gQIQUE8BwrZqK75+AAMSqZBvfkgUSM1UCyPzF8v81v6si+3cO47cgwWCexb8hR9OVn0M8F k7MNHcKegPCOyFlNWxb3wgRLx21GKLQWhVZMhRtyfm41VMdz5pt3jyHLAk39Rpk7zvEQCNSMfFm+b w6VXapoD3L6LhKiILnZwlw==; Date: Sat, 12 Oct 2024 15:31:33 +0300 Message-Id: <86frp1wli2.fsf@gnu.org> From: Eli Zaretskii To: Pengji Zhang In-Reply-To: <87bjztvec7.fsf@pengjiz.com> (message from Pengji Zhang on Wed, 09 Oct 2024 17:02:32 +0800) Subject: Re: bug#72870: [PATCH] Flow fill texts after the last hard newline References: <87cylr7gmj.fsf@pengjiz.com> <867cbnzysx.fsf@gnu.org> <87bjztvec7.fsf@pengjiz.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 72870-done Cc: 72870-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Pengji Zhang > Cc: 72870@debbugs.gnu.org > Date: Wed, 09 Oct 2024 17:02:32 +0800 > > Eli Zaretskii writes: > > >> PS I have sent an email to assign@gnu.org, but have not got a > >> response yet. I think I have not finished the copyright assignment > >> process? > > > > No. Please ping them and CC me, so we could get your paperwork process > > going. > > Hi Eli! Yesterday I was told that my assignment process had been > complete. Thanks, so I've now installed the patches, and I'm closing this bug. ------------=_1728736322-12844-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 29 Aug 2024 10:58:15 +0000 Received: from localhost ([127.0.0.1]:50551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sjcqz-0003BJ-JA for submit@debbugs.gnu.org; Thu, 29 Aug 2024 06:58:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:60700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sjcew-0002mU-DE for submit@debbugs.gnu.org; Thu, 29 Aug 2024 06:45:47 -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 1sjce2-0006b4-S7 for bug-gnu-emacs@gnu.org; Thu, 29 Aug 2024 06:44:50 -0400 Received: from fout1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sjce0-0005B6-Fx for bug-gnu-emacs@gnu.org; Thu, 29 Aug 2024 06:44:50 -0400 Received: from phl-compute-05.internal (phl-compute-05.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 65881138FFC6 for ; Thu, 29 Aug 2024 06:44:46 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Thu, 29 Aug 2024 06:44:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1724928286; x=1725014686; bh=FnX77ffryrLzGWyxnttayUAqQuoF4YSO bJLp02Emj8I=; b=LTu35bd8OlHRmlXqY0CgFGzyOr/6lBILDmvYJ2jK8IIeWyZW aj2Iy7BETesjr0Buk3JJe6d+tfoYQwPy7CVb7/Rib6a/o3nKndOk3oJPxyfVnjNf 0ur4no9JMWIPpGifvBRWghs6MwJ7HniM1+kOUE/4C6wbExW8ItnANT8jQsAIhqiE TAG/gqQVD2ycnJu19k2uOuy+Vf/75PngvA7ZBiUJJwtgp316VUKRruCyvkr3xiqa E3xhueDWDelbvgGsQxFCEO9l2FgIpZohXD8nSwsuf/HWtZDbzna8m3ryI02lwpLk K3yvSziyHGVTtJnh4nMjCOPsu3xWcnURWripaQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1724928286; x=1725014686; bh=FnX77ffryrLzGWyxnttayUAqQuoF4YSObJL p02Emj8I=; b=RiKw/mBY0G0kMQCMMvroIBqV2q3rzdDJXg+Pnqk/FUOpp/ic3Kw mH2GD8ixL7QRPCP5AcNDJ1s1DhIYfFppOdi9agw8WSiJj2gl6XkaUl3Gl0w6BJt1 00c7gzzX5DNIPWYSIyIMPgPVn98emSmSrSjuJrDfGIP6xJ6UZQyPy+NNF6eUSPAF qkuwgzukRruXm07D0j0rUvGthnXLGfgi2bdGB5yOv6vvKeQtJ4SAnt2ZMmbSwFHa 8/XyOueR1ipoBbZGMsPP9ysFoQBgP+lV5r4C1tuJbJz9buAX9EJHo0XJJGbM5WGh TYsBvsaY05kVyCSEcZY6vFCzcF4irNK7M1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudefgedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkgggtsehmtderredttddtnecuhfhrohhmpefrvghnghhjihcukghhrghnghcuoehmvges phgvnhhgjhhiiidrtghomheqnecuggftrfgrthhtvghrnhepfffgiefhgfduleelvdeiie dtvdefieegkedtkefftdeljefgheelvdffjeegteegnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepmhgvsehpvghnghhjihiirdgtohhmpdhnsg gprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegsuhhgqdhg nhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 29 Aug 2024 06:44:45 -0400 (EDT) From: Pengji Zhang To: bug-gnu-emacs@gnu.org Subject: [PATCH] Flow fill texts after the last hard newline Date: Thu, 29 Aug 2024 18:44:36 +0800 Message-ID: <87cylr7gmj.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.144; envelope-from=me@pengjiz.com; helo=fout1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 29 Aug 2024 06:58:12 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain; format=flowed Tags: patch Hello! I found that function `fill-flowed-encode' would not fill texts after the last hard newline in a buffer. To reproduce, run 'emacs -Q' and then evaluate the following snippet: --8<---------------cut here---------------start------------->8--- (with-current-buffer (get-buffer-create "*tmp-f=f*") (use-hard-newlines) (insert "1\n2") (fill-flowed-encode) (display-buffer (current-buffer))) --8<---------------cut here---------------end--------------->8--- The expected output should be '1 2', but the actual is '1\n2'. The first patch changes this. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Flow-fill-texts-after-the-last-hard-newline.patch >From 9320c59a212459181f81025e9895e9172dde1361 Mon Sep 17 00:00:00 2001 From: Pengji Zhang Date: Wed, 28 Aug 2024 18:57:35 +0800 Subject: [PATCH 1/2] Flow fill texts after the last hard newline * lisp/mail/flow-fill.el (fill-flowed-encode): Use `(point-max)' as `end' if there are no remaining hard newlines in buffer. This ensures that the last paragraph will always be encoded, even without a trailing hard newline. --- lisp/mail/flow-fill.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el index 919490ec5aa..d4ad7d45982 100644 --- a/lisp/mail/flow-fill.el +++ b/lisp/mail/flow-fill.el @@ -78,7 +78,9 @@ fill-flowed-encode (let ((start (point-min)) end) ;; Go through each paragraph, filling it and adding SPC ;; as the last character on each line. - (while (setq end (text-property-any start (point-max) 'hard 't)) + (while (and (< start (point-max)) + (setq end (or (text-property-any start (point-max) 'hard 't) + (point-max)))) (save-restriction (narrow-to-region start end) (let ((fill-column (eval fill-flowed-encode-column t))) -- 2.46.0 --=-=-= Content-Type: text/plain; format=flowed Besides, I found that the test case 'fill-flow-tests-fill-flowed-encode' in 'fill-flow-tests' does not actually test the function 'fill-flowed-encode', which requires 'use-hard-newlines'[1], and the test input does not cover some behaviors of the function. The second patch improves it a bit. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Improve-tests-for-flow-fill.patch >From 649509a3ce4fbc773ed9490b1dd214f1c18dea1e Mon Sep 17 00:00:00 2001 From: Pengji Zhang Date: Wed, 28 Aug 2024 19:11:35 +0800 Subject: [PATCH 2/2] Improve tests for flow-fill * test/lisp/mail/flow-fill-tests.el (fill-flow-tests-fill-flowed-decode): Remove debug message. (fill-flow-tests-fill-flowed-encode): Actually test function `fill-flowed-encode', which requires `use-hard-newline' to be non-nil. Also adjust test input to check behaviors of the function under different cases. --- test/lisp/mail/flow-fill-tests.el | 42 ++++++++++++++++++------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/test/lisp/mail/flow-fill-tests.el b/test/lisp/mail/flow-fill-tests.el index 1f698f538f3..50fbb1e7f80 100644 --- a/test/lisp/mail/flow-fill-tests.el +++ b/test/lisp/mail/flow-fill-tests.el @@ -54,37 +54,43 @@ fill-flow-tests-fill-flowed-decode (with-temp-buffer (insert input) (fill-flowed) - (message "foo") (should (equal (buffer-string) output))))) (ert-deftest fill-flow-tests-fill-flowed-encode () (let ((input (concat - "> Thou villainous ill-breeding spongy dizzy-eyed \n" - "> reeky elf-skinned pigeon-egg! \n" - ">> Thou artless swag-bellied milk-livered \n" - ">> dismal-dreaming idle-headed scut!\n" + ;; Hard newline in the middle of a level + "> Thou villainous ill-breeding spongy dizzy-eyed" hard-newline + "> reeky elf-skinned pigeon-egg!\n" + ">> Thou artless swag-bellied milk-livered\n" + ;; Hard new line at the end of a level + ">> dismal-dreaming idle-headed scut!" hard-newline + ;; Trailing space should be preserved after filling ">>> Thou errant folly-fallen spleeny reeling-ripe \n" ">>> unmuzzled ratsbane!\n" - ">>>> Henceforth, the coding style is to be strictly \n" + ">>>> Henceforth, the coding style is to be strictly\n" ">>>> enforced, including the use of only upper case.\n" - ">>>>> I've noticed a lack of adherence to the coding \n" + ;; Consecutive hard newlines within a level + ">>>>> I've noticed a lack of adherence to" hard-newline + ">>>>> the coding" hard-newline ">>>>> styles, of late.\n" ">>>>>> Any complaints?\n")) (output (concat - "> Thou villainous ill-breeding spongy dizzy-eyed \n" + "> Thou villainous ill-breeding spongy dizzy-eyed\n" "> reeky elf-skinned pigeon-egg! \n" - ">> Thou artless swag-bellied milk-livered \n" - ">> dismal-dreaming idle-headed scut!\n" - ">>> Thou errant folly-fallen spleeny reeling-ripe \n" - ">>> unmuzzled ratsbane!\n" - ">>>> Henceforth, the coding style is to be strictly \n" - ">>>> enforced, including the use of only upper case.\n" - ">>>>> I've noticed a lack of adherence to the coding \n" - ">>>>> styles, of late.\n" - ">>>>>> Any complaints?\n")) - (fill-flowed-display-column 69)) + ">> Thou artless swag-bellied milk-livered dismal-dreaming \n" + ">> idle-headed scut!\n" + ">>> Thou errant folly-fallen spleeny reeling-ripe unmuzzled \n" + ">>> ratsbane! \n" + ">>>> Henceforth, the coding style is to be strictly enforced, \n" + ">>>> including the use of only upper case. \n" + ">>>>> I've noticed a lack of adherence to\n" + ">>>>> the coding\n" + ">>>>> styles, of late. \n" + ">>>>>> Any complaints? \n")) + (use-hard-newlines t) + (fill-flowed-encode-column 66)) (with-temp-buffer (insert input) (fill-flowed-encode) -- 2.46.0 --=-=-= Content-Type: text/plain; format=flowed The second patch depends on the first one, without which the new test will fail. So I decided to submit both together. Please let me know if it is better to file another report. Thanks! Cheers, Pengji PS I have sent an email to assign@gnu.org, but have not got a response yet. I think I have not finished the copyright assignment process? [1] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/mail/flow-fill.el#n77 --=-=-=-- ------------=_1728736322-12844-1--