From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ferdinand Pieper Newsgroups: gmane.emacs.bugs Subject: bug#42855: 28.0.50; Format flowed does not flow multiple lines into one Date: Thu, 13 Aug 2020 19:51:03 +0200 Message-ID: <86zh6yjuyg.fsf@ims.uni-hannover.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33377"; mail-complaints-to="usenet@ciao.gmane.io" To: 42855@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 13 21:58:19 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6JMg-0008ZW-B0 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Aug 2020 21:58:18 +0200 Original-Received: from localhost ([::1]:52222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6JMf-00067k-9Y for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Aug 2020 15:58:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6JMQ-0005vw-Mr for bug-gnu-emacs@gnu.org; Thu, 13 Aug 2020 15:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39638) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k6JMQ-0002II-Dc for bug-gnu-emacs@gnu.org; Thu, 13 Aug 2020 15:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k6JMQ-0007Te-DG for bug-gnu-emacs@gnu.org; Thu, 13 Aug 2020 15:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ferdinand Pieper Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Aug 2020 19:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 42855 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.159734862828676 (code B ref -1); Thu, 13 Aug 2020 19:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Aug 2020 19:57:08 +0000 Original-Received: from localhost ([127.0.0.1]:51184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6JLX-0007SS-G2 for submit@debbugs.gnu.org; Thu, 13 Aug 2020 15:57:07 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:36742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6HNe-00029G-Tx for submit@debbugs.gnu.org; Thu, 13 Aug 2020 13:51:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6HNe-0001V6-Lv for bug-gnu-emacs@gnu.org; Thu, 13 Aug 2020 13:51:10 -0400 Original-Received: from pie.tf ([62.75.142.128]:48938) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k6HNb-0002La-TH for bug-gnu-emacs@gnu.org; Thu, 13 Aug 2020 13:51:10 -0400 Original-Received: from i577b6c81.versanet.de ([87.123.108.129] helo=localhost) by pie.tf with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1k6HNY-0003ZD-3A for bug-gnu-emacs@gnu.org; Thu, 13 Aug 2020 17:51:04 +0000 Received-SPF: pass client-ip=62.75.142.128; envelope-from=fer@pie.tf; helo=pie.tf X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 13:51:04 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 13 Aug 2020 15:57:07 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:185067 Archived-At: --=-=-= Content-Type: text/plain Refilling of format=flowed text can not fill multiple lines into one when it should (i.e. the summed line length is smaller than fill-flowed-display-column. Attached is a patch to fix this by collecting all flowed lines before calling fill-region. I hope I got the patch formatting correct. If not please let me know. Best, In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.17.3) of 2020-06-25 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-flow-filling-for-flowing-multiple-flowed-lines.patch >From 6993fa8d1b6555de58a986a0a7f3c433d57029fa Mon Sep 17 00:00:00 2001 From: fpi Date: Thu, 13 Aug 2020 19:17:28 +0200 Subject: [PATCH] Fix flow filling for flowing multiple flowed lines * lisp/mail/flow-fill.el (fill-flowed): Loop until all flowed lines are collected. * test/lisp/mail/flow-fill-tests.el (fill-flow-tests-fill-flowed-decode): Also test for multiple flowed lines. --- lisp/mail/flow-fill.el | 36 ++++++++++++++++++------------- test/lisp/mail/flow-fill-tests.el | 3 ++- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el index af3b493a08..f4b5503119 100644 --- a/lisp/mail/flow-fill.el +++ b/lisp/mail/flow-fill.el @@ -131,31 +131,37 @@ fill-flowed (goto-char (match-end 0)) (unless (looking-at " ") (insert " ")) - (end-of-line) - (when (and (not (eobp)) - (save-excursion - (forward-line 1) - (looking-at (format "\\(%s ?\\)[^>]" prefix)))) - ;; Delete the newline and the quote at the start of the - ;; next line. - (delete-region (point) (match-end 1)) - (ignore-errors + (while (and (eq (char-before (line-end-position)) ?\s) + (not (eobp)) + (save-excursion + (forward-line 1) + (looking-at (format "\\(%s ?\\)[^>]" prefix)))) + (end-of-line) + (when (and (not (eobp)) + (save-excursion + (forward-line 1) + (looking-at (format "\\(%s ?\\)[^>]" prefix)))) + ;; Delete the newline and the quote at the start of the + ;; next line. + (delete-region (point) (match-end 1)))) + (ignore-errors (let ((fill-prefix (concat prefix " ")) adaptive-fill-mode) (fill-region (line-beginning-position) (line-end-position) - 'left 'nosqueeze)))))) - (t + 'left 'nosqueeze))))) + (t ;; Delete the newline. (when (eq (following-char) ?\s) (delete-char 1)) ;; Hack: Don't do the flowing on the signature line. (when (and (not (looking-at "-- $")) (eq (char-before (line-end-position)) ?\s)) - (end-of-line) - (when delete-space - (delete-char -1)) - (delete-char 1) + (while (eq (char-before (line-end-position)) ?\s) + (end-of-line) + (when delete-space + (delete-char -1)) + (delete-char 1)) (ignore-errors (let ((fill-prefix "")) (fill-region (line-beginning-position) diff --git a/test/lisp/mail/flow-fill-tests.el b/test/lisp/mail/flow-fill-tests.el index 4d435aeda7..c2e4178b7d 100644 --- a/test/lisp/mail/flow-fill-tests.el +++ b/test/lisp/mail/flow-fill-tests.el @@ -35,7 +35,8 @@ fill-flow-tests-fill-flowed-decode ">>> 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" + ">>>>> I've noticed a lack of adherence to \n" + ">>>>> the coding \n" ">>>>> styles, of late.\n" ">>>>>> Any complaints?\n")) (output -- 2.27.0 --=-=-=--