From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matthias Schmitt Newsgroups: gmane.emacs.devel Subject: Fix fill-flowed for large or nil values of fill-flowed-display-column Date: Thu, 27 Jan 2022 12:13:58 +0000 Message-ID: <875yq5s6lh.fsf@posteo.de> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9832"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 27 16:18:35 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nD6Xj-0002Ko-Ld for ged-emacs-devel@m.gmane-mx.org; Thu, 27 Jan 2022 16:18:35 +0100 Original-Received: from localhost ([::1]:51236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD6Xi-0003Sn-Is for ged-emacs-devel@m.gmane-mx.org; Thu, 27 Jan 2022 10:18:34 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD3wG-0001xU-3p for emacs-devel@gnu.org; Thu, 27 Jan 2022 07:31:44 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:34231) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nD3wC-0002Tp-Gm for emacs-devel@gnu.org; Thu, 27 Jan 2022 07:31:43 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id E0E4B240105 for ; Thu, 27 Jan 2022 13:31:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1643286683; bh=FROpXpjNm5TVYrWsq2rI/EWCv/RXrmlEVlWc1Skd3gQ=; h=From:To:Subject:Date:From; b=aY3vCah2ywF0pdD1y2nCKjhRBHgwtJIhYa4rzxBcSwz0qjo877vG1dBotGZObrFz5 S80PDO2JD92JiDJ6xhqUpQ/4F1QyEssggBvPio7FScAdBMf9+5VjuBS36QbntPb2Tp XFSrKUY2FCcNKkDhy72RQ2rG00IsCrBe/WATZWegxG4TS2dop0biMVWK+VnjyO4LU7 5C6njiV/tVUlekDANM0SHuHVQ9EZDKWOEnpeE0yLym6KWDg0Y8W9Sd9MKzhTFt0ktv nS/dblgPay6tcdjUWJ9nasfSYZiGhO7HzXgzntP7W6g/w3BK/NyXNcR4ujZ5iVx7RZ JzFnvHOGyHXdw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Jl0Lz1vFhz9rxP for ; Thu, 27 Jan 2022 13:31:23 +0100 (CET) Received-SPF: pass client-ip=185.67.36.66; envelope-from=male.schmitt@posteo.de; helo=mout02.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 27 Jan 2022 10:09:21 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:285494 Archived-At: Hi, `fill-flowed` currently does not work correctly when the variable `fill-flowed-display-column` is large or nil (no hard line breaks e.g. when using `visual-fill-column-mode`). The origin of this behavior is that if `fill-region` does not break the current line but the current line should be merged with the next line moving a line forward is an error. This patch is a rather dirty fix that checks if the current line should be merged with the following line (ending in SPC CRLF) before moving over it. This is my first contribution to Emacs and the mailing list and I am happy to be a small part of the development of Emacs :) Cheers, Matthias diff -u --label \#\ --label \#\ /tmp/buffer-content-nY7QFh /tmp/buffer-content-zqOgJ3 --- # +++ # @@ -157,11 +157,12 @@ (delete-char -1)) (delete-char 1) (ignore-errors - (let ((fill-prefix "")) - (fill-region (line-beginning-position) - (line-end-position) - 'left 'nosqueeze)))))) - (forward-line 1))))) + (let ((fill-prefix "")) + (fill-region (line-beginning-position) + (line-end-position) + 'left 'nosqueeze)))))) + (unless (eq (char-before (line-end-position)) ?\s) + (forward-line 1)))))) (make-obsolete-variable 'fill-flowed-encode-tests nil "27.1") (defvar fill-flowed-encode-tests) Diff finished. Thu Jan 27 13:06:47 2022