Received: (at 71017) by debbugs.gnu.org; 4 Mar 2025 10:02:02 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 04 05:02:02 2025 Received: from localhost ([127.0.0.1]:55410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpP6A-0002sL-6N for submit <at> debbugs.gnu.org; Tue, 04 Mar 2025 05:02:02 -0500 Received: from fhigh-b4-smtp.messagingengine.com ([202.12.124.155]:52025) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <pablo@HIDDEN>) id 1tpP66-0002ry-R9 for 71017 <at> debbugs.gnu.org; Tue, 04 Mar 2025 05:02:00 -0500 Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.stl.internal (Postfix) with ESMTP id C0AE02540130; Tue, 4 Mar 2025 05:01:52 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Tue, 04 Mar 2025 05:01:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seestieto.com; h=cc:cc:content-transfer-encoding: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=fm1; t=1741082512; x=1741168912; bh=32vSuwwfiJC/sVLFNv9a5nswGPTXFVdU Gt8VNX4+rfw=; b=ienkAhRWgZUW6exLFSNVSlVzOAy3dVhj2z3dS8BsDvU+Cg1R lonzygo1+395+NQg8wVWwIHMOSS6xKXuWUVnE8hpovQ0b6O13X5mjEMWegyALN7Z LZZZQoAvnPEq3MXEoAsQs//MjjyZjvnQGmLPiqvPN7R+Jj93lyphdfLXG8VuMzKr nowyydJjRZjou3iKwbf/QOnTdKZkxey5nAHWyNMNKqLpc/yOOK4N1tmJT3gKh9JF snkRp0AFq1xRvLTB7HOhKBh44BivHxditsZz9s2iurp60VDbLQ8KyFZtkGfslSol Rdytw/osA0c7klr9ILGBR0AAUGJFQu6qhfFBgQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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-sender:x-me-sender:x-sasl-enc; s=fm1; t=1741082512; x= 1741168912; bh=32vSuwwfiJC/sVLFNv9a5nswGPTXFVdUGt8VNX4+rfw=; b=d MvMUZ6a0h0iVWN4Q+As9NsLXkaUHRxyJVEBaqKaDj6EVUSfa3VUa/XX4UoDxMvgq 0Tw0R/JvjXCZJzlEo0jD1k+GrVx9aJyrNEjaCOXycriyXBsP41gDcowxFqGAOVvN HivtWnKq5kFTEQPNG5nJSUl0cJp3rt7AddbPOzuq8E+8XD0WARHWD8HPpuZ6V7wh x8ey0qTjb61vxIBiGpBkJP8KsTksLfckm3EELGO9OtWXPEgQPXlZVxyOSnHERJtU QT86HC36h+LoRgUITbBwjMHUiQ7KjHxPuXtTnbnYpzyFMRWpM+/X70KkWrDYH2ia uCaAkpcwpF7g6Gr0M/l5A== X-ME-Sender: <xms:kM_GZ0DLQxSqtApYyzwDxuqIPMUPVU8LXTY1lW4TM9PTsLmr0vtGQg> <xme:kM_GZ2gmb7Dptba3Y1bVyNWKRNJV1Q8tbC-nqarcm4GA1OLmVOBxL8yKcZMZq9H5o fFsDn-lOc5-Hw> X-ME-Received: <xmr:kM_GZ3kiFYtAPsu-lmKm0-5_OFCG1pfR6lv91DKzIKynm6YbvVkJ0dv-JtGZ3wE6RoTaO2UCloVXeh2xK8SZNZY> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddutddujeefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephffvvefujghffffkfgggtgfgsehtqhertddt reejnecuhfhrohhmpefjvghnrhhikhcutehhlhhgrhgvnhcuoehprggslhhosehsvggvsh htihgvthhordgtohhmqeenucggtffrrghtthgvrhhnpeevtdejieevveeiieeuffethfff veffleetfeevhfegleefleelhfevkeefveegieenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehprggslhhosehsvggvshhtihgvthhordgtohhm pdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeejud dtudejseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepshgrnhgurhgrrdhs nhgrnhesihguihhomhgurhhothhtnhhinhhgrdhorhhg X-ME-Proxy: <xmx:kM_GZ6zPZy-UyxGTsTTtPIYE1yvpI28UgoDozn9cyePmIhD4saZ_eA> <xmx:kM_GZ5S4m0qJiX3-hxTw6VSvBV50qs92bFFoPXgRflyI9dCUIuzLPQ> <xmx:kM_GZ1Yrea2imYhbUVCJJJNh0qt_KJA45p-QN47LYiA_avU9uVPqtw> <xmx:kM_GZyRJbLOGnSrIqYybJcPm1VO2cWUq85JelQLo_ctuYUlC9E5pwg> <xmx:kM_GZ7dlnzF9n6p_GHGaJ37lytDscsIz2CPgTwghVuP_tjbx7U6YlhkC> Feedback-ID: i8ea641e4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 4 Mar 2025 05:01:50 -0500 (EST) From: Henrik Ahlgren <pablo@HIDDEN> To: Sandra Snan <sandra.snan@HIDDEN> Subject: Re: bug#71017: fill-flowed-encode In-Reply-To: <20240707100252.2553609-1-sandra.snan@HIDDEN> (Sandra Snan's message of "Sun, 7 Jul 2024 12:02:52 +0200") References: <87le2dblzz.fsf@HIDDEN> <20240707100252.2553609-1-sandra.snan@HIDDEN> Date: Tue, 04 Mar 2025 12:01:49 +0200 Message-ID: <87plixw1v6.fsf_-_@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 71017 Cc: 71017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) Thank you, Sandra, for addressing this bug. It=E2=80=99s one reason I=20 hesitate to send f=3Df messages with Gnus, despite the clear=20 advantages of a properly functioning f=3Df implementation. I=E2=80=99m curious if others have experienced the following behavior: when sending a f=3Df message with use-hard-newlines enabled, the last paragraph sometimes gets filled into the previous one, with two or three spaces in between. I=E2=80=99m unsure how to consistently reproduce this issue.
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 71017) by debbugs.gnu.org; 7 Jul 2024 10:03:34 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 07 06:03:34 2024 Received: from localhost ([127.0.0.1]:47392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sQOk2-0004ny-43 for submit <at> debbugs.gnu.org; Sun, 07 Jul 2024 06:03:34 -0400 Received: from halsen.idiomdrottning.org ([74.207.231.133]:54818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sandra.snan@HIDDEN>) id 1sQOjz-0004np-Kf for 71017 <at> debbugs.gnu.org; Sun, 07 Jul 2024 06:03:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idiomdrottning.org; s=idiomdrottningorg; t=1720346576; bh=uQqaOZhGUrFHaabyMbvirHH/NJ5sVn1KviiTsenJuKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WY6KaiATl1aZR00GgzZ3pqoL9Td2BDwbiM7/a9si/6FX4jXA29SzVsdoPdlAr5Ymc zIBwjT70yBMxryHuDinYvLNF5Emtbtaodki3VOhbahKOAkbHlLyMiaZzf7HrUcDAMz edHv7pfp5GK4wprHFOloifoV/h8tFrSEAT6equVJJht+Ie7e+SZYebuDL7HMGCBqCi x3Ozcl3hiXtEmIpvpEt91JM8Buezlw9hUFy41E7P8z/DubXQPHmgVtTvCOcnohPdN0 GXAbdmzCbGqjNDqQRSF6IWfm52GGQsRBLyd/KbvdPdNOtoKdFZ2MXgE+P8arz0mwrg FnIn/oRL5+Qzw== Received: from localhost (31-211-247-254.customers.ownit.se [31.211.247.254]) by halsen.idiomdrottning.org (Postfix) with ESMTPSA id 0239C21B94; Sun, 7 Jul 2024 12:02:55 +0200 (CEST) From: Sandra Snan <sandra.snan@HIDDEN> To: 71017 <at> debbugs.gnu.org Subject: [PATCH] Flow single-paragraph messages Date: Sun, 7 Jul 2024 12:02:52 +0200 Message-Id: <20240707100252.2553609-1-sandra.snan@HIDDEN> X-Mailer: git-send-email 2.39.2 In-Reply-To: <87le2dblzz.fsf@HIDDEN> References: <87le2dblzz.fsf@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 71017 Cc: Sandra Snan <sandra.snan@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) See discussion in #71017. In short: if mml-flowed-enable is nil: no change to behavior if mml-flowed-enable is t and use-hard-newlines is on: several bugs fixed, some (multi-paragraph messages) of which were counter to documentation and some (single-paragraph messages) that were along documentation lines but which messed up messages royally. if mml-flowed-enable is t but use-hard-newlines was accidentally forgotten by user: new behavior; reflow but don't reflow together separate paragraphs nor reflow across lines that markdown would've considered hard. --- doc/misc/emacs-mime.texi | 7 +-- lisp/gnus/mml.el | 29 ++++++------- lisp/mail/flow-fill.el | 93 ++++++++++++++++++++++++---------------- 3 files changed, 69 insertions(+), 60 deletions(-) diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index ef7ea61..7621a9a 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -1087,13 +1087,10 @@ terminated by soft newline characters are filled together and wrapped after the column decided by @code{fill-flowed-encode-column}. Quotation marks (matching @samp{^>* ?}) are respected. The variable controls how the text will look in a client that does not support -flowed text, the default is to wrap after 66 characters. If hard -newline characters are not present in the buffer, no flow encoding -occurs. +flowed text, the default is to wrap after 66 characters. You can customize the value of the @code{mml-enable-flowed} variable -to enable or disable the flowed encoding usage when newline -characters are present in the buffer. +to enable or disable the flowed encoding usage. On decoding flowed text, lines with soft newline characters are filled together and wrapped after the column decided by diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index e3bc393..2db39dc 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -691,23 +691,18 @@ type detected." (t ;; Only perform format=flowed filling on text/plain ;; parts where there either isn't a format parameter - ;; in the mml tag or it says "flowed" and there - ;; actually are hard newlines in the text. - (let (use-hard-newlines) - (when (and mml-enable-flowed - (string= type "text/plain") - (not (string= (cdr (assq 'sign cont)) "pgp")) - (or (null (assq 'format cont)) - (string= (cdr (assq 'format cont)) - "flowed")) - (setq use-hard-newlines - (text-property-any - (point-min) (point-max) 'hard 't))) - (fill-flowed-encode) - ;; Indicate that `mml-insert-mime-headers' should - ;; insert a "; format=flowed" string unless the - ;; user has already specified it. - (setq flowed (null (assq 'format cont))))) + ;; in the mml tag or it says "flowed". + (when (and mml-enable-flowed + (string= type "text/plain") + (not (string= (cdr (assq 'sign cont)) "pgp")) + (or (null (assq 'format cont)) + (string= (cdr (assq 'format cont)) + "flowed"))) + (fill-flowed-encode) + ;; Indicate that `mml-insert-mime-headers' should + ;; insert a "; format=flowed" string unless the + ;; user has already specified it. + (setq flowed (null (assq 'format cont)))) ;; Prefer `utf-8' for text/calendar parts. (if (or charset (not (string= type "text/calendar"))) diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el index 919490e..793088a 100644 --- a/lisp/mail/flow-fill.el +++ b/lisp/mail/flow-fill.el @@ -73,50 +73,67 @@ RFC 2646 suggests 66 characters for readability." ;;;###autoload (defun fill-flowed-encode (&optional buffer) (with-current-buffer (or buffer (current-buffer)) - ;; No point in doing this unless hard newlines is used. - (when use-hard-newlines - (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)) - (save-restriction - (narrow-to-region start end) - (let ((fill-column (eval fill-flowed-encode-column t))) - (fill-flowed-fill-buffer)) - (goto-char (point-min)) - (while (re-search-forward "\n" nil t) - (replace-match " \n" t t)) - (goto-char (setq start (1+ (point-max))))))) - t))) - -(defun fill-flowed-fill-buffer () - (let ((prefix nil) - (prev-prefix nil) - (start (point-min))) - (goto-char (point-min)) - (while (not (eobp)) - (setq prefix (and (looking-at "[> ]+") - (match-string 0))) - (if (equal prefix prev-prefix) - (forward-line 1) + (let ((fill-column (eval fill-flowed-encode-column t)) + (start (point-min)) + (end (point-max))) + ;; Only when we've been called to reflow a buffer that doesn't + ;; have any hard newlines: + (unless (text-property-any start end 'hard 't) + (save-excursion + ;; Harden between paras: + (goto-char start) + (while (re-search-forward "\n[> ]*\n" end t) + (set-hard-newline-properties + (match-beginning 0) (point)) + (backward-char)) + ;; Harden before a quote starts: + (goto-char start) + (while (re-search-forward "\n[^>][^\n]*\n>" end t) + (backward-char) + (set-hard-newline-properties + (1- (point)) (point))) + ;; Harden " $" + (goto-char start) + (while (search-forward " \n" end t) + (backward-char) + (backward-delete-char 2) + (set-hard-newline-properties + (point) (1+ (point)))) + ;; Harden "^ " + (goto-char start) + (while (search-forward "\n " end t) + (set-hard-newline-properties + (- (point) 5) (- (point) 4))))) + ;; Go through each paragraph, filling it and adding SPC + ;; as the last character on each line. + (while (and (< start (point-max)) + (setq end (or (text-property-any start (point-max) 'hard 't) + (point-max)))) (save-restriction - (narrow-to-region start (point)) - (let ((fill-prefix prev-prefix)) - (fill-region (point-min) (point-max) t 'nosqueeze 'to-eop)) - (goto-char (point-max))) - (setq prev-prefix prefix - start (point)))) - (save-restriction - (narrow-to-region start (point)) - (let ((fill-prefix prev-prefix)) - (fill-region (point-min) (point-max) t 'nosqueeze 'to-eop))))) + (narrow-to-region start end) + (let ((prefix + (concat "\n" + (or (and (looking-at ">[> ]*") + (match-string 0)) "")))) + (goto-char start) + (while (search-forward prefix nil t) + (replace-match " " t t)) + (goto-char start) + (while (< (+ (point) fill-column) (point-max)) + (let ((start (point))) + (forward-char fill-column) + (when (search-backward " " start t) + (forward-char) + (insert prefix))))) + (setq start (1+ (point-max)))))) + t)) ;;;###autoload (defun fill-flowed (&optional buffer delete-space) "Apply RFC2646 decoding to BUFFER. If BUFFER is nil, default to the current buffer. -If DELETE-SPACE, delete RFC2646 spaces padding at the end of +If DELETE-SPACE, delete RFC3676 spaces padding at the end of lines." (with-current-buffer (or buffer (current-buffer)) (let ((fill-column (eval fill-flowed-display-column t))) @@ -154,7 +171,7 @@ lines." ;; Delete the newline. (when (eq (following-char) ?\s) (delete-char 1)) - ;; Hack: Don't do the flowing on the signature line. + ;; As per RFC3767: Don't do the flowing on the signature line. (when (and (not (looking-at "-- $")) (eq (char-before (line-end-position)) ?\s)) (while (and (not (eobp)) -- 2.39.2
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Received: (at 71017) by debbugs.gnu.org; 7 Jul 2024 09:16:25 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 07 05:16:24 2024 Received: from localhost ([127.0.0.1]:47377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sQO0O-0003d0-M7 for submit <at> debbugs.gnu.org; Sun, 07 Jul 2024 05:16:24 -0400 Received: from halsen.idiomdrottning.org ([74.207.231.133]:49760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sandra.snan@HIDDEN>) id 1sQO0N-0003cq-4W for 71017 <at> debbugs.gnu.org; Sun, 07 Jul 2024 05:16:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idiomdrottning.org; s=idiomdrottningorg; t=1720343778; bh=ww3EPRTzHBlIXk0l8dhfz27BzTtlMkNmN4L5rFk8sJ4=; h=From:To:Subject:In-Reply-To:References:Date:From; b=11ddRnnmgjUbuba8KTrzpQoNzpJm58Hw6zRb4jXsjYpI7k6iAOHtVKJQBxEIy/6it Oqap4rBx30VQVhVQf6aEcz7ATnA6LQievXK+jbxc7VFHH53BNvT3H61mSEOzx5GODg JLQsin5zffAEnzYAe6cUQSQ1GCs3XNdjAXDGdo4YjxhKy0wAijIV238/7tkyGjCM89 LPXsXV0vxISCcvV0WpqYklfCqBlg+AhGCB5sd2X2KO58bPq7uNqzUgXtdPpC0lZvKr og41YPAE9zxqXJdFn6XdkfVS1/WsdjHctC/VownHjejLoBzRvT7Ip+CaFn90ERkHrG mJCCiu+H+RRCw== Received: from localhost (31-211-247-254.customers.ownit.se [31.211.247.254]) by halsen.idiomdrottning.org (Postfix) with ESMTPSA id 038B91E3F3; Sun, 7 Jul 2024 11:16:17 +0200 (CEST) From: Sandra Snan <sandra.snan@HIDDEN> To: 71017 <at> debbugs.gnu.org Subject: Re: [PATCH] Flow single-paragraph messages In-Reply-To: <20240707090448.2550042-1-sandra.snan@HIDDEN> References: <87plrpbnye.fsf@HIDDEN> <20240707090448.2550042-1-sandra.snan@HIDDEN> Autocrypt: addr=sandra.snan@HIDDEN; prefer-encrypt=mutual; keydata= mDMEZWEIEhYJKwYBBAHaRw8BAQdAahVPtpoqkiV62AL3GSY4JaPS0i3Bu3fhbe5WIFQG9pa0LFNh bmRyYSBTbmFuIDxzYW5kcmEuc25hbkBpZGlvbWRyb3R0bmluZy5vcmc+iJMEExYIADsCGwMFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AWIQSM+QwgZjV9IBEt0Difw0TKEvFISgUCZWJbSgIZAQAKCRCf w0TKEvFIShsYAPsFMXn+tFcAwdI2hrkqqQY8I5EC9UWYC9t57VjiYv2uYQD+PUNVHVSBGQDycf3V /nXqXvZvTfcFMOz0PVMzibPl0AiIkAQTFggAOBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgS AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEJ/DRMoS8UhK07EA/iV2B5e3r8t8/StJT38d x9YbuoSBmbYZJ6JHH9hoyv0hAPwMiH1M8zZUeQK/TQDqkg2Hjk0xL+U7i9ggocLJEAWQDbg4BGVh CBISCisGAQQBl1UBBQEBB0BqHjRRmoXeZmeeUZOqL1ebAflzYFA3jHwxl2sLMLlMCgMBCAeIeAQY FggAIBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgSAhsMAAoJEJ/DRMoS8UhK4o0BAOB7ChkN Jc0oxRDg9WvrbUCnpLU/QdjMFcC8ymLRdzxaAP4gZVL0JQfxulc/JAxotCevk1PAF+UXpY8QalTI dooaAA== Date: Sun, 07 Jul 2024 11:16:16 +0200 Message-ID: <87le2dblzz.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 71017 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eww, I forgot about quote handling for this autoharden fallback.
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Received: (at 71017) by debbugs.gnu.org; 7 Jul 2024 09:05:31 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 07 05:05:31 2024 Received: from localhost ([127.0.0.1]:47372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sQNpr-0003N8-0h for submit <at> debbugs.gnu.org; Sun, 07 Jul 2024 05:05:31 -0400 Received: from halsen.idiomdrottning.org ([74.207.231.133]:56622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sandra.snan@HIDDEN>) id 1sQNpo-0003My-TX for 71017 <at> debbugs.gnu.org; Sun, 07 Jul 2024 05:05:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idiomdrottning.org; s=idiomdrottningorg; t=1720343094; bh=czRuG8HQfuDOspi4AYIxA3cv6da6L3pQ6BuB5QJQakk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wm6/cR+BzXdgMQ+pEK/Nt0Ey9dwyXa4pT4+HaOnT3BBal/iz5Xzm9U38AhnE9mRHs C+pWPd4XsDLINuWPhNE6rdKvlvOvH+qblxJvcMyBYBzYFzR2Jue14UdTS2UeyfXRGF 1rDXt+mgQsFj0aMkmIolufpwXUWW4zLo+LA/+Rv6tCKgEG84ATqauu025RHv2dlihM hhxPfpfqCS9IZqd+/hFGp9Qhllq78DgJBuJgFNJqjan2pCS1IhB2ja9YYvbdza6jMG UtxDNQDZ1yP5kFray+AH+Bkjr2gGHRVTJOzQek4BOEb/L4GqLQdVGBqTDIeYnVutLY sdo92jjXn01kA== Received: from localhost (31-211-247-254.customers.ownit.se [31.211.247.254]) by halsen.idiomdrottning.org (Postfix) with ESMTPSA id 6412320407; Sun, 7 Jul 2024 11:04:53 +0200 (CEST) From: Sandra Snan <sandra.snan@HIDDEN> To: 71017 <at> debbugs.gnu.org Subject: [PATCH] Flow single-paragraph messages Date: Sun, 7 Jul 2024 11:04:48 +0200 Message-Id: <20240707090448.2550042-1-sandra.snan@HIDDEN> X-Mailer: git-send-email 2.39.2 In-Reply-To: <87plrpbnye.fsf@HIDDEN> References: <87plrpbnye.fsf@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 71017 Cc: Sandra Snan <sandra.snan@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) See discussion in #71017. In short: if mml-flowed-enable is nil: no change to behavior if mml-flowed-enable is t and use-hard-newlines is on: several bugs fixed, some (multi-paragraph messages) of which were counter to documentation and some (single-paragraph messages) that were along documentation lines but which messed up messages royally. if mml-flowed-enable is t but use-hard-newlines was accidentally forgotten by user: new behavior; reflow but don't reflow together separate paragraphs nor reflow across lines that markdown would've considered hard. --- doc/misc/emacs-mime.texi | 7 +--- lisp/gnus/mml.el | 29 ++++++-------- lisp/mail/flow-fill.el | 86 ++++++++++++++++++++++------------------ 3 files changed, 62 insertions(+), 60 deletions(-) diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index ef7ea61..7621a9a 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -1087,13 +1087,10 @@ terminated by soft newline characters are filled together and wrapped after the column decided by @code{fill-flowed-encode-column}. Quotation marks (matching @samp{^>* ?}) are respected. The variable controls how the text will look in a client that does not support -flowed text, the default is to wrap after 66 characters. If hard -newline characters are not present in the buffer, no flow encoding -occurs. +flowed text, the default is to wrap after 66 characters. You can customize the value of the @code{mml-enable-flowed} variable -to enable or disable the flowed encoding usage when newline -characters are present in the buffer. +to enable or disable the flowed encoding usage. On decoding flowed text, lines with soft newline characters are filled together and wrapped after the column decided by diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index e3bc393..2db39dc 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -691,23 +691,18 @@ type detected." (t ;; Only perform format=flowed filling on text/plain ;; parts where there either isn't a format parameter - ;; in the mml tag or it says "flowed" and there - ;; actually are hard newlines in the text. - (let (use-hard-newlines) - (when (and mml-enable-flowed - (string= type "text/plain") - (not (string= (cdr (assq 'sign cont)) "pgp")) - (or (null (assq 'format cont)) - (string= (cdr (assq 'format cont)) - "flowed")) - (setq use-hard-newlines - (text-property-any - (point-min) (point-max) 'hard 't))) - (fill-flowed-encode) - ;; Indicate that `mml-insert-mime-headers' should - ;; insert a "; format=flowed" string unless the - ;; user has already specified it. - (setq flowed (null (assq 'format cont))))) + ;; in the mml tag or it says "flowed". + (when (and mml-enable-flowed + (string= type "text/plain") + (not (string= (cdr (assq 'sign cont)) "pgp")) + (or (null (assq 'format cont)) + (string= (cdr (assq 'format cont)) + "flowed"))) + (fill-flowed-encode) + ;; Indicate that `mml-insert-mime-headers' should + ;; insert a "; format=flowed" string unless the + ;; user has already specified it. + (setq flowed (null (assq 'format cont)))) ;; Prefer `utf-8' for text/calendar parts. (if (or charset (not (string= type "text/calendar"))) diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el index 919490e..932aa8f 100644 --- a/lisp/mail/flow-fill.el +++ b/lisp/mail/flow-fill.el @@ -73,50 +73,60 @@ RFC 2646 suggests 66 characters for readability." ;;;###autoload (defun fill-flowed-encode (&optional buffer) (with-current-buffer (or buffer (current-buffer)) - ;; No point in doing this unless hard newlines is used. - (when use-hard-newlines - (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)) - (save-restriction - (narrow-to-region start end) - (let ((fill-column (eval fill-flowed-encode-column t))) - (fill-flowed-fill-buffer)) - (goto-char (point-min)) - (while (re-search-forward "\n" nil t) - (replace-match " \n" t t)) - (goto-char (setq start (1+ (point-max))))))) - t))) - -(defun fill-flowed-fill-buffer () - (let ((prefix nil) - (prev-prefix nil) - (start (point-min))) - (goto-char (point-min)) - (while (not (eobp)) - (setq prefix (and (looking-at "[> ]+") - (match-string 0))) - (if (equal prefix prev-prefix) - (forward-line 1) + (let ((fill-column (eval fill-flowed-encode-column t)) + (start (point-min)) + (end (point-max))) + ;; Only when we've been called to reflow a buffer that doesn't + ;; have any hard newlines: + (unless (text-property-any start end 'hard 't) + (save-excursion + ;; Harden between paras: + (goto-char start) + (while (search-forward "\n\n" end t) + (set-hard-newline-properties + (- (point) 2) (point))) + ;; Harden " $" + (goto-char start) + (while (search-forward " \n" end t) + (backward-char) + (backward-delete-char 2) + (set-hard-newline-properties + (point) (1+ (point)))) + ;; Harden "^ " + (goto-char start) + (while (search-forward "\n " end t) + (set-hard-newline-properties + (- (point) 5) (- (point) 4))))) + ;; Go through each paragraph, filling it and adding SPC + ;; as the last character on each line. + (while (and (< start (point-max)) + (setq end (or (text-property-any start (point-max) 'hard 't) + (point-max)))) (save-restriction - (narrow-to-region start (point)) - (let ((fill-prefix prev-prefix)) - (fill-region (point-min) (point-max) t 'nosqueeze 'to-eop)) - (goto-char (point-max))) - (setq prev-prefix prefix - start (point)))) - (save-restriction - (narrow-to-region start (point)) - (let ((fill-prefix prev-prefix)) - (fill-region (point-min) (point-max) t 'nosqueeze 'to-eop))))) + (narrow-to-region start end) + (let ((prefix + (concat "\n" + (or (and (looking-at ">[> ]*") + (match-string 0)) "")))) + (goto-char start) + (while (search-forward prefix nil t) + (replace-match " " t t)) + (goto-char start) + (while (< (+ (point) fill-column) (point-max)) + (let ((start (point))) + (forward-char fill-column) + (when (search-backward " " start t) + (forward-char) + (insert prefix))))) + (setq start (1+ (point-max)))))) + t)) ;;;###autoload (defun fill-flowed (&optional buffer delete-space) "Apply RFC2646 decoding to BUFFER. If BUFFER is nil, default to the current buffer. -If DELETE-SPACE, delete RFC2646 spaces padding at the end of +If DELETE-SPACE, delete RFC3676 spaces padding at the end of lines." (with-current-buffer (or buffer (current-buffer)) (let ((fill-column (eval fill-flowed-display-column t))) @@ -154,7 +164,7 @@ lines." ;; Delete the newline. (when (eq (following-char) ?\s) (delete-char 1)) - ;; Hack: Don't do the flowing on the signature line. + ;; As per RFC3767: Don't do the flowing on the signature line. (when (and (not (looking-at "-- $")) (eq (char-before (line-end-position)) ?\s)) (while (and (not (eobp)) -- 2.39.2
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Received: (at 71017) by debbugs.gnu.org; 7 Jul 2024 08:34:42 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 07 04:34:42 2024 Received: from localhost ([127.0.0.1]:47337 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sQNM2-0002ar-34 for submit <at> debbugs.gnu.org; Sun, 07 Jul 2024 04:34:42 -0400 Received: from halsen.idiomdrottning.org ([74.207.231.133]:54550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sandra.snan@HIDDEN>) id 1sQNLz-0002ah-Gm for 71017 <at> debbugs.gnu.org; Sun, 07 Jul 2024 04:34:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idiomdrottning.org; s=idiomdrottningorg; t=1720341243; bh=xDmA02pY/dqwjXErU8a7G0d37PWYBVptSbS89HjDGWo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lT7+Mnowh53s1wFpkEOrq23RW1Bxwc7quJCIaquBzHYTADJbMxptedCjNfThtcRuT phwK58qqUqx8qXGFEvq/x9XLAv1+OBYEOFMH2cYDZfRayvWOdoYYsv1FpbjuO/BEyV Dcy3EEzuqcNr4qeE+/jmAbZgW6w23jOb2sLd1O2pj7SQx9j0DvJPhEtgaIL00NwZR3 hLCa7sseA894RbJxhoL9NmxYsrBarEp9hbM9KgQCFkbWXIQ/MAGZw2chdVJG03j5xy 5poanjIVqatrfokwoSWy0yxZTcASZvi34vu6eCKBxa4+/tKDK9pqLZaHyDgMHqlXZv gIfAVQW28YeuQ== Received: from localhost (31-211-247-254.customers.ownit.se [31.211.247.254]) by halsen.idiomdrottning.org (Postfix) with ESMTPSA id 8259320F46; Sun, 7 Jul 2024 10:34:02 +0200 (CEST) From: Sandra Snan <sandra.snan@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN>, Eric Abrahamsen <eric@HIDDEN> Subject: Re: bug#71017: [PATCH] Flow single-paragraph messages In-Reply-To: <86h6d13gf6.fsf@HIDDEN> References: <CADwFkm=GGEz=a=uJR+fffdVKqiqG_D+athgYuZgKduE68aTEew@HIDDEN> <20240706204950.2437581-1-sandra.snan@HIDDEN> <86h6d13gf6.fsf@HIDDEN> Autocrypt: addr=sandra.snan@HIDDEN; prefer-encrypt=mutual; keydata= mDMEZWEIEhYJKwYBBAHaRw8BAQdAahVPtpoqkiV62AL3GSY4JaPS0i3Bu3fhbe5WIFQG9pa0LFNh bmRyYSBTbmFuIDxzYW5kcmEuc25hbkBpZGlvbWRyb3R0bmluZy5vcmc+iJMEExYIADsCGwMFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AWIQSM+QwgZjV9IBEt0Difw0TKEvFISgUCZWJbSgIZAQAKCRCf w0TKEvFIShsYAPsFMXn+tFcAwdI2hrkqqQY8I5EC9UWYC9t57VjiYv2uYQD+PUNVHVSBGQDycf3V /nXqXvZvTfcFMOz0PVMzibPl0AiIkAQTFggAOBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgS AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEJ/DRMoS8UhK07EA/iV2B5e3r8t8/StJT38d x9YbuoSBmbYZJ6JHH9hoyv0hAPwMiH1M8zZUeQK/TQDqkg2Hjk0xL+U7i9ggocLJEAWQDbg4BGVh CBISCisGAQQBl1UBBQEBB0BqHjRRmoXeZmeeUZOqL1ebAflzYFA3jHwxl2sLMLlMCgMBCAeIeAQY FggAIBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgSAhsMAAoJEJ/DRMoS8UhK4o0BAOB7ChkN Jc0oxRDg9WvrbUCnpLU/QdjMFcC8ymLRdzxaAP4gZVL0JQfxulc/JAxotCevk1PAF+UXpY8QalTI dooaAA== Date: Sun, 07 Jul 2024 10:34:01 +0200 Message-ID: <87plrpbnye.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 71017 Cc: 71017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Eli Zaretskii <eliz@HIDDEN> writes: > Thanks. (I also see RFC 3676 mentioned -- what is this about?) I mentioned RFC 3676 twice for different reasons. First, it's introduced the delsp parameter which wasn't in 2646 so code related to that parameter shouldn't talk about 2646 but rather 3676. Second, I saw a comment referring to not tampering with the sig line as a hack. I happened to have the section of RFC 3676 open that mandates that behavior so I changed the comment, however, this might be in RFC 2646 also, I don't know that, so in that case that comment might better change to refer to 2646 instead. >> First, the old code didn't refill or encode the last paragraph >> at all unless there was at least one hard newline EOF. > > Isn't this the documented behavior? Re multi-paragraph messages: No, it's not the documented behavior, it was an unrelated bug in fill-flowed-encode. It would refill all the other paragraphs, separated by hard newlines, just not the last one. That was a bug and broke documented behavior. I fixed that bug + another unrelated reflow bug. That was in fill-flowed-encode and that bugfix doesn't rely on the change in mml. With my fix in fill-flowed-encode, multi-paragraph-messages started working fine. Re single-paragraph messages: However, according to the old documented behavior, a message that contained no hard newlines should not be refilled. This documented behavior in mml-generate-mime-1 meant that single-paragraph messages would not be filled even with the fill-flowed-encode bug fixed. That is an unintended bad consequence of the documented behavior, a "bug in the design". I did change that but I updated the documentation to match. > The change seems to be an incompatible behavior change, so I > wonder whether we'd need some way for users to get back old > behavior. There is still the (neglected) defcustom mml-enable-flowed which now becomes more relevant since it's a way to turn off all this meddling and reflowing in the first place. The old documented behavior was bugged-by-design. It's not right that single paragraph messages are hardwrapped and not reflowed. In my day-to-day I write many messages in Emacs that I later see in threads in another MUA (Delta Chat) and these messages stand out in a way that something is wrong with them. However, one intent behind the old behavior was, in spirit, good: It'd be good to detect whether or not users with mml-enable-flowed on have remembered to also turn on use-hard-newlines, which is important for users with that on to do, especially since mml-enable-flowed defaults to t. The old attempt at doing that was flawed since it only worked reliably for multi-paragraph messages. Unfortunately there's currently no way to detect in a single-paragraph message whether or not use-hard-newlines have been turned on, since the variable it sets is buffer local. (One extremely klugy workaround would be to change the message-send-and-exit command to check whether use-hard-newlines is on and if it is, add an extra hard newline EOT just for detecting this. Not super into that solution so hopefully there are other ways.) With this patch, the defcustom mml-enable-flowed becomes _the_ setting for this, which does match a lot of documentation on the books. Perhaps it shall no longer default to t though since it completely borks messages up if it's t but use-hard-newlines are not on! So here we are: The new behavior has a problem: messages will get reflowed if mml-enable-flowed is t (the default!) even when use-hard-newlines is off, meaning that even separate "\n\n" paragraphs will get flowed together which is not what people want. Use-hard-newlines should be mandatory whenever mml-enable-flowed is on. The old behavior is not OK since single-paragraph messages will get messed up, hardwrapped even when those newlines were advertised as "soft", or not softwrapped even when the paragraph consists of just one single super long unbroken line. I also have sent a patch to the messages-are-flowing project highlighting the importance of this variable: https://github.com/legoscia/messages-are-flowing/pull/15/commits/ae432723c2565ceced5d01d9aa2d314bd42aaa3c So how about this idea: If mml-enable-flowed is on but fill-flowed-encode is asked to flow a message that doesn't have any hard newlines, assume Markdown semantics, i.e. special treatment for "\n\n+", " $", and "^ ". I'll see if I have time to implement that this morning. I think I'd place that change in fill-flowed-encode. That wouldn't affect people with mml-enable-flowed off, or people with both mml-enable-flowed and use-hard-newlines on, it'd just be a sort of DWIM fallback based on the guess that markdown semantics are somewhat widely known or expected in 2024, to prevent separate paragraphs to be flowed together for people with "incorrect" settings. Again, if there were a cross-buffer way to reliably detect whether use-hard-newlines is on, that dwimmy fallback wouldn't be needed. I thought about whether it'd have been better if it was instead soft newlines that were marked with a text property, not hard ones, but in the end that wouldn't properly softwrap messages with just one single overly long line.
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Received: (at 71017) by debbugs.gnu.org; 7 Jul 2024 05:44:11 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 07 01:44:11 2024 Received: from localhost ([127.0.0.1]:47093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sQKh0-0000gE-PQ for submit <at> debbugs.gnu.org; Sun, 07 Jul 2024 01:44:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1sQKgy-0000g0-TG for 71017 <at> debbugs.gnu.org; Sun, 07 Jul 2024 01:44:09 -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 <eliz@HIDDEN>) id 1sQKgp-0000c1-8q; Sun, 07 Jul 2024 01:43:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=eTfDt4SKyk9XXbLNEieXGpihpkivrx9PPS4c+wx5/D4=; b=nmjp8T6Y8c2n3EdcJxlh 53qkJKT5dBBjc5z5Qooon9CE1eGm5sa75hXNFiaf7L4ce+rmmRqLsr/JLvw7chtMZsgD8V4yUK8wG q0HXR/wgKxdcn2MBCZNWY2rE4AGrebvBrNz4+WKDRtH9ArrLBxeYwZOdqOioEAafkkTm3MIIOWk1k 5XgHLIY0dH322oXkCSvFPCi6DQVu/3gt0jLRP6rX+gzS70U1VRn7C6+NzrJIf9hInSleM3rhs89gx GhVdOtmPm2/fPg72NPsFVY8Tr31uwQBjpHTHerMdTOsy4J2nHLxrP8BsHF9ledtlHKjoFHok+t+rA QI+vmTfxE+PLvg==; Date: Sun, 07 Jul 2024 08:43:57 +0300 Message-Id: <86h6d13gf6.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Sandra Snan <sandra.snan@HIDDEN>, Eric Abrahamsen <eric@HIDDEN> In-Reply-To: <20240706204950.2437581-1-sandra.snan@HIDDEN> (bug-gnu-emacs@HIDDEN) Subject: Re: bug#71017: [PATCH] Flow single-paragraph messages References: <CADwFkm=GGEz=a=uJR+fffdVKqiqG_D+athgYuZgKduE68aTEew@HIDDEN> <20240706204950.2437581-1-sandra.snan@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 71017 Cc: 71017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Cc: Sandra Snan <sandra.snan@HIDDEN> > Date: Sat, 6 Jul 2024 22:49:50 +0200 > From: Sandra Snan via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> > > This fixes two bugs when sending RFC 2646–formatted email. Thanks. (I also see RFC 3676 mentioned -- what is this about?) > First, the old code didn't refill or encode the last paragraph at all > unless there was at least one hard newline EOF. Isn't this the documented behavior? > But for months dogfooding those two changes, sometimes a hardwrapped > email would still be sent. I finally managed to debug and figure it out > and it took all day. Turns out mml just plain didn't call the > fill-flowed-encode function if the message doesn't have any hard > newlines (newlines with the hard text property). Well, of course a > single-paragraph email isn't gonna have any hard newlines! But it still > needs reflowing! > > So I've now changed that and updated the documentation to match those > news semantics. I went all the way, but a possible compromise might be > to not-flow a message that has \n\n but no hard text props, since that's > a sign that something is wrong. The change seems to be an incompatible behavior change, so I wonder whether we'd need some way for users to get back old behavior. Eric, WDYT? I'll leave it to Eric to comment on the code changes.
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Received: (at 71017) by debbugs.gnu.org; 6 Jul 2024 20:50:38 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 06 16:50:38 2024 Received: from localhost ([127.0.0.1]:46817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sQCMf-0003wk-Ji for submit <at> debbugs.gnu.org; Sat, 06 Jul 2024 16:50:38 -0400 Received: from halsen.idiomdrottning.org ([74.207.231.133]:52762) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sandra.snan@HIDDEN>) id 1sQCMd-0003wc-87 for 71017 <at> debbugs.gnu.org; Sat, 06 Jul 2024 16:50:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idiomdrottning.org; s=idiomdrottningorg; t=1720299000; bh=lmuQGTjWN4927bO4vKX5iEfXrWxxAbGq4HODUc/uCjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ne1SrF7uOmnq4i4ulU9Siilr+Y76/0vHmsdBqUdZzr59QqZdFI7ySEzJaJ+89fO2j ksDAjZWSzJ5AFFy7xyp/l0fKZz41ZJaXUkQl5eBj7QZ/emlMhzLObScdzPav3tIHur 8c3Og/y+7s2Mz7ImmUkJywkEa06NSTvhqqKQCpEMWdSm+4zxcHdpm5cpYeTupe/APb KSHoeouyC8JY4cWeqzPqdlYqc2J4OCQBq1yL0OSQR4JbJJ/LIqe6DTWLVpVeTuavtn +IeaHyBOmqIGrO7vUO3j9FoPiMOtKm5oGciamve2Tjs8eHWRiFwF1SwgZLeaCnVPB3 VSppWo58iCdJA== Received: from localhost (31-211-247-254.customers.ownit.se [31.211.247.254]) by halsen.idiomdrottning.org (Postfix) with ESMTPSA id B3E231ECA6; Sat, 6 Jul 2024 22:49:58 +0200 (CEST) From: Sandra Snan <sandra.snan@HIDDEN> To: 71017 <at> debbugs.gnu.org Subject: [PATCH] Flow single-paragraph messages Date: Sat, 6 Jul 2024 22:49:50 +0200 Message-Id: <20240706204950.2437581-1-sandra.snan@HIDDEN> X-Mailer: git-send-email 2.39.2 In-Reply-To: <CADwFkm=GGEz=a=uJR+fffdVKqiqG_D+athgYuZgKduE68aTEew@HIDDEN> References: <CADwFkm=GGEz=a=uJR+fffdVKqiqG_D+athgYuZgKduE68aTEew@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 71017 Cc: Sandra Snan <sandra.snan@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) This fixes two bugs when sending RFC 2646–formatted email. First, the old code didn't refill or encode the last paragraph at all unless there was at least one hard newline EOF. This was a bee to track down because there were two separate issues at play. One was a a bug in flow-fill.el where every paragraph except the last paragraph was reflowed, but the last paragraph would stay hardwrapped. Manually placing a hard newline at the end of the file was a workaround but I don't always remember to do that. I managed to fix that bug a few months ago. Second, the old code borked up code indented with tabs and spaces (iff that code had overly long lines), such as Lisp code. It could sometimes insert extra whitespace in the middle of such long lines. I fixed that bug shortly after the first one. But for months dogfooding those two changes, sometimes a hardwrapped email would still be sent. I finally managed to debug and figure it out and it took all day. Turns out mml just plain didn't call the fill-flowed-encode function if the message doesn't have any hard newlines (newlines with the hard text property). Well, of course a single-paragraph email isn't gonna have any hard newlines! But it still needs reflowing! So I've now changed that and updated the documentation to match those news semantics. I went all the way, but a possible compromise might be to not-flow a message that has \n\n but no hard text props, since that's a sign that something is wrong. Since the use-hard-newlines variable is buffer local and all this reflowing is being done in a temp buffer, that variable is more than useless so I've removed references to it. --- doc/misc/emacs-mime.texi | 7 ++--- lisp/gnus/mml.el | 29 ++++++++---------- lisp/mail/flow-fill.el | 65 +++++++++++++++++----------------------- 3 files changed, 41 insertions(+), 60 deletions(-) diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index ef7ea61..7621a9a 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -1087,13 +1087,10 @@ terminated by soft newline characters are filled together and wrapped after the column decided by @code{fill-flowed-encode-column}. Quotation marks (matching @samp{^>* ?}) are respected. The variable controls how the text will look in a client that does not support -flowed text, the default is to wrap after 66 characters. If hard -newline characters are not present in the buffer, no flow encoding -occurs. +flowed text, the default is to wrap after 66 characters. You can customize the value of the @code{mml-enable-flowed} variable -to enable or disable the flowed encoding usage when newline -characters are present in the buffer. +to enable or disable the flowed encoding usage. On decoding flowed text, lines with soft newline characters are filled together and wrapped after the column decided by diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index e3bc393..2db39dc 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -691,23 +691,18 @@ type detected." (t ;; Only perform format=flowed filling on text/plain ;; parts where there either isn't a format parameter - ;; in the mml tag or it says "flowed" and there - ;; actually are hard newlines in the text. - (let (use-hard-newlines) - (when (and mml-enable-flowed - (string= type "text/plain") - (not (string= (cdr (assq 'sign cont)) "pgp")) - (or (null (assq 'format cont)) - (string= (cdr (assq 'format cont)) - "flowed")) - (setq use-hard-newlines - (text-property-any - (point-min) (point-max) 'hard 't))) - (fill-flowed-encode) - ;; Indicate that `mml-insert-mime-headers' should - ;; insert a "; format=flowed" string unless the - ;; user has already specified it. - (setq flowed (null (assq 'format cont))))) + ;; in the mml tag or it says "flowed". + (when (and mml-enable-flowed + (string= type "text/plain") + (not (string= (cdr (assq 'sign cont)) "pgp")) + (or (null (assq 'format cont)) + (string= (cdr (assq 'format cont)) + "flowed"))) + (fill-flowed-encode) + ;; Indicate that `mml-insert-mime-headers' should + ;; insert a "; format=flowed" string unless the + ;; user has already specified it. + (setq flowed (null (assq 'format cont)))) ;; Prefer `utf-8' for text/calendar parts. (if (or charset (not (string= type "text/calendar"))) diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el index 919490e..5c9ae21 100644 --- a/lisp/mail/flow-fill.el +++ b/lisp/mail/flow-fill.el @@ -73,50 +73,39 @@ RFC 2646 suggests 66 characters for readability." ;;;###autoload (defun fill-flowed-encode (&optional buffer) (with-current-buffer (or buffer (current-buffer)) - ;; No point in doing this unless hard newlines is used. - (when use-hard-newlines - (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)) - (save-restriction - (narrow-to-region start end) - (let ((fill-column (eval fill-flowed-encode-column t))) - (fill-flowed-fill-buffer)) - (goto-char (point-min)) - (while (re-search-forward "\n" nil t) - (replace-match " \n" t t)) - (goto-char (setq start (1+ (point-max))))))) - t))) - -(defun fill-flowed-fill-buffer () - (let ((prefix nil) - (prev-prefix nil) - (start (point-min))) - (goto-char (point-min)) - (while (not (eobp)) - (setq prefix (and (looking-at "[> ]+") - (match-string 0))) - (if (equal prefix prev-prefix) - (forward-line 1) + (let ((fill-column (eval fill-flowed-encode-column t)) + (start (point-min)) + end) + ;; Go through each paragraph, filling it and adding SPC + ;; as the last character on each line. + (while (and (< start (point-max)) + (setq end (or (text-property-any start (point-max) 'hard 't) + (point-max)))) (save-restriction - (narrow-to-region start (point)) - (let ((fill-prefix prev-prefix)) - (fill-region (point-min) (point-max) t 'nosqueeze 'to-eop)) - (goto-char (point-max))) - (setq prev-prefix prefix - start (point)))) - (save-restriction - (narrow-to-region start (point)) - (let ((fill-prefix prev-prefix)) - (fill-region (point-min) (point-max) t 'nosqueeze 'to-eop))))) + (narrow-to-region start end) + (let ((prefix + (concat "\n" + (or (and (looking-at ">[> ]*") + (match-string 0)) "")))) + (goto-char start) + (while (search-forward prefix nil t) + (replace-match " " t t)) + (goto-char start) + (while (< (+ (point) fill-column) (point-max)) + (let ((start (point))) + (forward-char fill-column) + (when (search-backward " " start t) + (forward-char) + (insert prefix))))) + (setq start (1+ (point-max)))))) + t)) ;;;###autoload (defun fill-flowed (&optional buffer delete-space) "Apply RFC2646 decoding to BUFFER. If BUFFER is nil, default to the current buffer. -If DELETE-SPACE, delete RFC2646 spaces padding at the end of +If DELETE-SPACE, delete RFC3676 spaces padding at the end of lines." (with-current-buffer (or buffer (current-buffer)) (let ((fill-column (eval fill-flowed-display-column t))) @@ -154,7 +143,7 @@ lines." ;; Delete the newline. (when (eq (following-char) ?\s) (delete-char 1)) - ;; Hack: Don't do the flowing on the signature line. + ;; As per RFC3767: Don't do the flowing on the signature line. (when (and (not (looking-at "-- $")) (eq (char-before (line-end-position)) ?\s)) (while (and (not (eobp)) -- 2.39.2
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Received: (at 71017) by debbugs.gnu.org; 30 Jun 2024 14:35:26 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 10:35:25 2024 Received: from localhost ([127.0.0.1]:58632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sNveH-00062F-HV for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 10:35:25 -0400 Received: from mail-ed1-f49.google.com ([209.85.208.49]:56580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1sNveF-000627-OG for 71017 <at> debbugs.gnu.org; Sun, 30 Jun 2024 10:35:24 -0400 Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-57cd26347d3so2651318a12.1 for <71017 <at> debbugs.gnu.org>; Sun, 30 Jun 2024 07:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719758063; x=1720362863; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=tW0tsHROR4p5YLwOqk8xa2rUpWs/nOmcbPjxjCZxRFM=; b=AwJCFnZsxY7tiQ9HK+0wC8XB0RSvwVct/tsWJK0SGtAw4xM4gy8oLjRH4q1kk7PxHZ DzsIqKIppFkFWyl2h/Nl+cVERFQwCThOAsOfCzEBw5RRx2lHA7mNstEILW7miHxrQW6j 8r+ZDcwrbjDkct0xuGTY3R/Kf6FGLugAWci/1KjXF5f5bMNwb0E+Sf1kYPNrZefWYqDG Vz2n9qa6iRJNYpzbSYoitRCSyC9ouI0kTDJUDtG3Jt9GQRCWsAvflnXCNJALSOeBbUKu clALvAG39xcwZzaE87yilHHerXzINtsMh2ghPxZa4JaLeSddCnbyO93nvvv9UtjVHofh x4Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719758063; x=1720362863; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tW0tsHROR4p5YLwOqk8xa2rUpWs/nOmcbPjxjCZxRFM=; b=wV3nISKPHR+wVNeqvm02eauZOOVnj8WYkFBO6C38CBGOk8V85EwgM9f1TRbDw3RHzL O9brwYmub2ASEBYufD5xea7C+48AWVewLr+N0ykfmvTZ+/plx6Tysg2uT+204WqOFAKK bNtkTULbj/qww7Z6g+cjNCzC2fed2Ria41McBG+kq86E43K+28luqIYpgH4FOjwuoJV/ DsK5boQLSUgVxCyFwMY0F49FJV7JnDcsjdOQBixImzKpX1QLFO5WQ5NhMj2ZRdmop3nI Be7eOATOvghFNy5FfIEWHqBGr2qBUxG4mP1BR02ewWaHIKADAlMaT/iaNaU+XxIX1Nuc /YUQ== X-Gm-Message-State: AOJu0YzFYN1JdsFG5vTzwIAhenP0Ckum9wQXvTaGQkqf9VHep5i0D09y d1ekY5NqBn+7l7l06FD2mFEGStWFklRAJziBmbAxszLkB2xI0YIjJhz4hLC6gBVCzdjX4avuDoP AWElfHTy0orKUAmEROc5qa0bns55Wooki X-Google-Smtp-Source: AGHT+IH1QgS20yo0+t1KWI13Ec9xYoZGHkO0qaupsvBauSvEsf5FZMeasGP26dQZQNImvWOOJIZpnCJ/WPk0yubnv/A= X-Received: by 2002:a05:6402:5111:b0:57c:da58:51e7 with SMTP id 4fb4d7f45d1cf-5879eaff6cemr2386501a12.1.1719758062591; Sun, 30 Jun 2024 07:34:22 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 30 Jun 2024 07:34:21 -0700 From: Stefan Kangas <stefankangas@HIDDEN> In-Reply-To: <871q4ej0f1.fsf@HIDDEN> References: <87v83cfaqx.fsf@HIDDEN> <CADwFkm=fhoQGLgEHv6XsDPTzyeJBO+--krz+4RkoBoLjtGg1bQ@HIDDEN> <871q4ej0f1.fsf@HIDDEN> MIME-Version: 1.0 Date: Sun, 30 Jun 2024 07:34:21 -0700 Message-ID: <CADwFkm=GGEz=a=uJR+fffdVKqiqG_D+athgYuZgKduE68aTEew@HIDDEN> Subject: Re: bug#71017: fill-flowed-encode To: Sandra Snan <sandra.snan@HIDDEN> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 71017 Cc: 71017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Sandra Snan <sandra.snan@HIDDEN> writes: > I'm glad I'm gonna get a chance to resend because I've fixed some > more bugs in the version I've been dogfooding since I first sent > that so I wanna send an updated version that has that. Great, thanks. > Normally when I'm sending Emacs lisp patches, it's on packages and > they're usually in git already. Here it's a core file so the > question I've got is what is the git repo I should make the change > in? Then I could git send-email to this In-Reply-To thread id. https://git.savannah.gnu.org/cgit/emacs.git Please have a look at the CONTRIBUTE file in the Emacs source distribution. https://git.savannah.gnu.org/cgit/emacs.git/tree/CONTRIBUTE
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Received: (at 71017) by debbugs.gnu.org; 30 Jun 2024 08:32:41 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 04:32:41 2024 Received: from localhost ([127.0.0.1]:54956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sNpzF-0000oj-4B for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 04:32:41 -0400 Received: from halsen.idiomdrottning.org ([74.207.231.133]:55062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sandra.snan@HIDDEN>) id 1sNpzD-0000ob-Ks for 71017 <at> debbugs.gnu.org; Sun, 30 Jun 2024 04:32:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idiomdrottning.org; s=idiomdrottningorg; t=1719736359; bh=+bzUEKMoxMOX88JNCeSx8uxV33R8fjq6rhTWeFG+5r4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=qVqfLg7jferlNcjc3Xpn07HQ5Me9xkpWf5o5KoDWHPxQB+ODuHdOeknON+nllmBsp WxJiVeKLLFKfBvGJmiEKEQmuEG1aCMs6i5ztieoRZhvJnfVnnukfHuaJiYBoGLLnEK UhxrKE0hOYHlOMIMN+ZVWfKuaaBYTLewrbgP9uWC4blf3mWIGx4TgNLmysJaFGcWnC 3T2kBI7cN6z2xZQw/bHS/oueI76YR4v7R5JxHiVlTdnkgF3dro6Ht3C4P7acHJh5yY 8zF73q8BNi8COe+2a2LRnw+bog3dOslUOSbqQZEgttM03rt0wXlbKGlN05zh+DFk5i h3iynErDbt/ew== Received: from localhost (31-211-247-254.customers.ownit.se [31.211.247.254]) by halsen.idiomdrottning.org (Postfix) with ESMTPSA id 12CEC21B05; Sun, 30 Jun 2024 10:32:35 +0200 (CEST) From: Sandra Snan <sandra.snan@HIDDEN> To: Stefan Kangas <stefankangas@HIDDEN> Subject: Re: bug#71017: fill-flowed-encode In-Reply-To: <CADwFkm=fhoQGLgEHv6XsDPTzyeJBO+--krz+4RkoBoLjtGg1bQ@HIDDEN> References: <87v83cfaqx.fsf@HIDDEN> <CADwFkm=fhoQGLgEHv6XsDPTzyeJBO+--krz+4RkoBoLjtGg1bQ@HIDDEN> Autocrypt: addr=sandra.snan@HIDDEN; prefer-encrypt=mutual; keydata= mDMEZWEIEhYJKwYBBAHaRw8BAQdAahVPtpoqkiV62AL3GSY4JaPS0i3Bu3fhbe5WIFQG9pa0LFNh bmRyYSBTbmFuIDxzYW5kcmEuc25hbkBpZGlvbWRyb3R0bmluZy5vcmc+iJMEExYIADsCGwMFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AWIQSM+QwgZjV9IBEt0Difw0TKEvFISgUCZWJbSgIZAQAKCRCf w0TKEvFIShsYAPsFMXn+tFcAwdI2hrkqqQY8I5EC9UWYC9t57VjiYv2uYQD+PUNVHVSBGQDycf3V /nXqXvZvTfcFMOz0PVMzibPl0AiIkAQTFggAOBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgS AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEJ/DRMoS8UhK07EA/iV2B5e3r8t8/StJT38d x9YbuoSBmbYZJ6JHH9hoyv0hAPwMiH1M8zZUeQK/TQDqkg2Hjk0xL+U7i9ggocLJEAWQDbg4BGVh CBISCisGAQQBl1UBBQEBB0BqHjRRmoXeZmeeUZOqL1ebAflzYFA3jHwxl2sLMLlMCgMBCAeIeAQY FggAIBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgSAhsMAAoJEJ/DRMoS8UhK4o0BAOB7ChkN Jc0oxRDg9WvrbUCnpLU/QdjMFcC8ymLRdzxaAP4gZVL0JQfxulc/JAxotCevk1PAF+UXpY8QalTI dooaAA== Date: Sun, 30 Jun 2024 10:32:34 +0200 Message-ID: <871q4ej0f1.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 71017 Cc: 71017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Stefan Kangas <stefankangas@HIDDEN> writes: > Could you please resend the above as patches formatted by > > git format-patch -1 > > ? > I'm glad I'm gonna get a chance to resend because I've fixed some=20 more bugs in the version I've been dogfooding since I first sent=20 that so I wanna send an updated version that has that. Normally when I'm sending Emacs lisp patches, it's on packages and=20 they're usually in git already. Here it's a core file so the=20 question I've got is what is the git repo I should make the change=20 in? Then I could git send-email to this In-Reply-To thread id. Stefan Kangas <stefankangas@HIDDEN> writes: > Sandra Snan <sandra.snan@HIDDEN> writes: > >> Hi y'all. > > Hi Sandra, > >> flow-fill.el.gz has a pair of functions, fill-flowed-encode and=20 >> fill-flowed-fill-buffer (the latter is only called from the=20 >> former). >> Here is a fixed version of the former that then also=20 >> deprecates the latter (I have signed FSF copyright papers): >>=20 >> (defun fill-flowed-encode (&optional buffer) (with-current-buffer=20 >> (or buffer (current-buffer)) ;; No point in doing this unless=20 >> hard newlines is used. (when use-hard-newlines (let ((start=20 >> (point-min)) end) ;; Go through each paragraph, filling it and=20 >> adding SPC ;; as the last character on each line. (while (and (<=20 >> start (point-max)) (setq end (or (text-property-any start=20 >> (point-max) 'hard 't) (point-max)))) (save-restriction=20=09=20= =20=20 >> (narrow-to-region start end) (let ((fill-column (eval=20 >> fill-flowed-encode-column t)) (prefix (concat "\n"=20=09=09=09= =20=20=20 >> (or (and (looking-at ">[> ]*") (match-string 0)) ""))))=20=09=20= =20=20 >> (while (search-forward prefix nil t) (replace-match " " t t))=20 >> (goto-char start) (while (< (+ (point) fill-column)=20 >> (point-max)) (forward-char fill-column) (search-backward " ")=20 >> (forward-char) (insert prefix))) (setq start (1+=20 >> (point-max)))))) t))) >> This fixes two bugs when sending RFC=20 >> 2646=E2=80=93formatted email. >> First, the old code didn't refill or=20 >> encode the last paragraph at all unless there was at least one hard=20 >> newline EOF. >> Second, the old code borked up code indented with=20 >> tabs and spaces (iff that code had overly long lines), such as the=20 >> Lisp code in this email. It could sometimes insert extra in the=20 >> middle of such long lines. >> Here is an example of what it would=20 >> do. It would turn this: >> (defun lorem (ipsum) (dolor sit amet)=20=20 >> (consectetur adipiscing elit (sed do eiusmod tempor incididunt ut=20 >> labore et dolore magna aliqua)) (ut enim ad minim veniam=20=20=20=20=20= =20 >> (quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea=20 >> commodo consequat (duis aute irure dolor in reprehenderit=20 >> in voluptate velit esse cillum dolore eu fugiat nulla=20 >> pariatur) excepteur sint occaecat cupidatat non proident=20=09=20= =20=20=20 >> (sunt in culpa qui officia deserunt mollit anim id est=20 >> laborumd)))) >> into this: >> (defun lorem (ipsum) (dolor sit=20 >> amet) (consectetur adipiscing elit (sed do eiusmod tempor=20 >> incididunt ut labore et dolore magna aliqua)) (ut enim ad minim=20 >> veniam (quis nostrud exercitation ullamco laboris nisi ut=20 >> aliquip ex ea commodo consequat (duis aute irure dolor in=20 >> reprehenderit in voluptate velit esse cillum dolore eu=20 >> fugiat nulla pariatur) excepteur sint occaecat cupidatat non=20 >> proident (sunt in culpa qui officia deserunt mollit anim id=20 >> est laborumd)))) >> It was breaking lines awkwardly so when=20 >> they're reconnected they have extra whitespace in the mkddle of=20 >> lines. > > Could you please resend the above as patches formatted by > > git format-patch -1 > > ? > > It will make it easier for us to review and install the proposed=20 > changes. Thanks in advance.
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Received: (at 71017) by debbugs.gnu.org; 30 Jun 2024 05:45:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 30 01:45:18 2024 Received: from localhost ([127.0.0.1]:54536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sNnNF-00051M-CC for submit <at> debbugs.gnu.org; Sun, 30 Jun 2024 01:45:18 -0400 Received: from mail-ed1-f48.google.com ([209.85.208.48]:55649) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1sNnND-0004e1-FU for 71017 <at> debbugs.gnu.org; Sun, 30 Jun 2024 01:45:16 -0400 Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-57d1d45ba34so2339312a12.3 for <71017 <at> debbugs.gnu.org>; Sat, 29 Jun 2024 22:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719726250; x=1720331050; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=sd6qnd+OyvkN07DJryFTTSAaftrzkwtzuRoPVcN53Ro=; b=kCZsYKxHBFFrllkETckVduA5sSPlPNx3BKIfK5kXkPJCiIY0IyH0aTpPu8T5wIpTLD NEcmpAjZpDNSlg9LX3EJoKEIfJcfOigiKhivU5ev4S8YrYr0P9qI6KiZLFOZR0eu70uo 2p7VcfZIJLr7I+RAlmoULO2HWWpZRvW2I+xM/F9vpsuAIxOUj2ql6AVv0HFczDxJn5Jf eJDthdEcICyOYwmvNZwHV6s7qCIJBQF69+90PTK2em7waAtA/Ee5vSRcBFVsEiXDQbLg ApqQEp+RjfGkRL3Lx9qvyxMRxvpl8qxglePMcAZMwB+gyJ7nqGyq8hN5sLzTz+BqeZnl l73Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719726250; x=1720331050; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=sd6qnd+OyvkN07DJryFTTSAaftrzkwtzuRoPVcN53Ro=; b=RXu+FnCmAZ4OUZG5I2OGavs84UmlpZehDATmnXpPDUKMvDL8xdkZ32QlY7p8nr9ZNc UefxlHyo8f43MKlUrzFP7juZBX09Zdw/OJsb/S/K14tPdVwWXWSRBDfWlQxwLMbInP87 fZikI36Nm+WurJDUugzQpslfg4mTZFwXl1wyqXTKUyEjUV9kQdUZVhjo0f/HB8sGs6lu GXD+cFF93SOYUjZGJoVUYCIWDzlpQtJaq5MCuNqEXTSknzcGOh3Rn3lnyofQViOCusnP /jrvuK68f6s4/f9k6NrvztlgBPXLoiM5ccaG7g4I3q9I1OY5GC7t6JyuK0VDiBsFoOSi Ye3Q== X-Gm-Message-State: AOJu0YxRQQ9XMnOdlI71gCmhbYHqKGAPgcL+7IbPFq0ajIxBNb4t3H7i H3Ch4uBZObBmDcQ5qjYD8qaZw5JjGxWlrE+N4rHifTpTiHdm/fLbMabXG+07UW8aFXZwmA+UXzg Jo0zyMeU3KvHPq+brNNsJyWx9xjUIWo3ZILM= X-Google-Smtp-Source: AGHT+IH5kV9nxgj/jh12zTBY466KRzzldJi78weHBjoAnHo6fj79Z2e61SYkOuHJoV8banEx20J5AcxlMOfBXNJckPI= X-Received: by 2002:a05:6402:37b:b0:57c:c712:a3c7 with SMTP id 4fb4d7f45d1cf-587a10d9892mr1164219a12.36.1719726249827; Sat, 29 Jun 2024 22:44:09 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 29 Jun 2024 22:44:09 -0700 From: Stefan Kangas <stefankangas@HIDDEN> In-Reply-To: <87v83cfaqx.fsf@HIDDEN> (Sandra Snan's message of "Fri, 17 May 2024 22:23:50 +0200") References: <87v83cfaqx.fsf@HIDDEN> MIME-Version: 1.0 Date: Sat, 29 Jun 2024 22:44:09 -0700 Message-ID: <CADwFkm=fhoQGLgEHv6XsDPTzyeJBO+--krz+4RkoBoLjtGg1bQ@HIDDEN> Subject: Re: bug#71017: fill-flowed-encode To: Sandra Snan <sandra.snan@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 71017 Cc: 71017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Sandra Snan <sandra.snan@HIDDEN> writes: > Hi y'all. Hi Sandra, > flow-fill.el.gz has a pair of functions, fill-flowed-encode and > fill-flowed-fill-buffer (the latter is only called from the former). > > Here is a fixed version of the former that then also deprecates the latte= r (I > have signed FSF copyright papers): > > (defun fill-flowed-encode (&optional buffer) > (with-current-buffer (or buffer (current-buffer)) > ;; No point in doing this unless hard newlines is used. > (when use-hard-newlines > (let ((start (point-min)) end) > ;; Go through each paragraph, filling it and adding SPC > ;; as the last character on each line. > (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)) > (prefix > (concat "\n" > (or (and (looking-at ">[> ]*") > (match-string 0)) "")))) > (while (search-forward prefix nil t) > (replace-match " " t t)) > (goto-char start) > (while (< (+ (point) fill-column) (point-max)) > (forward-char fill-column) > (search-backward " ") > (forward-char) > (insert prefix))) > (setq start (1+ (point-max)))))) > t))) > > This fixes two bugs when sending RFC 2646=E2=80=93formatted email. > > First, the old code didn't refill or encode the last paragraph at all unl= ess > there was at least one hard newline EOF. > > Second, the old code borked up code indented with tabs and spaces (iff th= at code > had overly long lines), such as the Lisp code in this email. It could som= etimes > insert extra in the middle of such long lines. > > Here is an example of what it would do. It would turn this: > > (defun lorem (ipsum) > (dolor sit amet) > (consectetur adipiscing elit (sed do eiusmod tempor incididunt ut labore= et > dolore magna aliqua)) > (ut enim ad minim veniam > (quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea com= modo > consequat > (duis aute irure dolor in reprehenderit in > voluptate velit esse cillum dolore > eu fugiat nulla pariatur) > excepteur sint occaecat cupidatat non proident > (sunt in culpa qui officia deserunt mollit anim id est laborumd)))) > > into this: > > (defun lorem (ipsum) > (dolor sit amet) > (consectetur adipiscing elit (sed do eiusmod tempor incididunt > ut labore et dolore magna aliqua)) > (ut enim ad minim veniam > (quis nostrud exercitation ullamco laboris nisi ut aliquip > ex ea commodo consequat > (duis aute irure dolor in reprehenderit in > voluptate velit esse cillum dolore > eu fugiat nulla pariatur) > excepteur sint occaecat cupidatat non proident > (sunt in culpa qui officia deserunt mollit anim id est > laborumd)))) > > It was breaking lines awkwardly so when they're reconnected they have ext= ra > whitespace in the mkddle of lines. Could you please resend the above as patches formatted by git format-patch -1 ? It will make it easier for us to review and install the proposed changes. Thanks in advance.
bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 17 May 2024 20:24:03 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 17 16:24:03 2024 Received: from localhost ([127.0.0.1]:57098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s847X-0000vK-CP for submit <at> debbugs.gnu.org; Fri, 17 May 2024 16:24:03 -0400 Received: from lists.gnu.org ([209.51.188.17]:55324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sandra.snan@HIDDEN>) id 1s847V-0000ux-Aw for submit <at> debbugs.gnu.org; Fri, 17 May 2024 16:24:01 -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 <sandra.snan@HIDDEN>) id 1s847R-0000EU-VQ for bug-gnu-emacs@HIDDEN; Fri, 17 May 2024 16:23:57 -0400 Received: from halsen.idiomdrottning.org ([2600:3c02:e000:179::7]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <sandra.snan@HIDDEN>) id 1s847Q-0004lQ-4Y for bug-gnu-emacs@HIDDEN; Fri, 17 May 2024 16:23:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=idiomdrottning.org; s=idiomdrottningorg; t=1715977433; bh=625oJ9asc1AuPwGhH9RwhVYK9NzLY3xmpBPfbkPpI+E=; h=From:To:Subject:Date:From; b=pg3mNRuaT//9hc8v+j0IwS3ME5IA19lyOTEkm83NIlIjGV32xCHCPT+FeVMIeBdR8 KcdQZCDNsVV34q7AJeDz/Pm9tgw5tivj6JwYY9cxYJxnb4MClAzxDwcARmduB/xD3U Z4f/2Bz0xeCEg0seheu4Kfh8KF3gP1RcNNnLDnPTiV4ElYHMY3fcVXh/DNASVnzSwi CX5UkJEuvtDEefBcFanO46IdQCrt9xCUatrhxIQUCZ2nuRQeEXdo2DItbUPjc08gie eeVfdf3Wj/AYfj0nwH9sq2/C1U3PFlfL5BR0w34A9IkJPSigKH0CkB4qfuPgcjOZib 6PVZa7K0v87cw== Received: from localhost (31-211-247-254.customers.ownit.se [31.211.247.254]) by halsen.idiomdrottning.org (Postfix) with ESMTPSA id 427281FB6B; Fri, 17 May 2024 22:23:52 +0200 (CEST) From: Sandra Snan <sandra.snan@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: fill-flowed-encode Autocrypt: addr=sandra.snan@HIDDEN; prefer-encrypt=mutual; keydata= mDMEZWEIEhYJKwYBBAHaRw8BAQdAahVPtpoqkiV62AL3GSY4JaPS0i3Bu3fhbe5WIFQG9pa0LFNh bmRyYSBTbmFuIDxzYW5kcmEuc25hbkBpZGlvbWRyb3R0bmluZy5vcmc+iJMEExYIADsCGwMFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AWIQSM+QwgZjV9IBEt0Difw0TKEvFISgUCZWJbSgIZAQAKCRCf w0TKEvFIShsYAPsFMXn+tFcAwdI2hrkqqQY8I5EC9UWYC9t57VjiYv2uYQD+PUNVHVSBGQDycf3V /nXqXvZvTfcFMOz0PVMzibPl0AiIkAQTFggAOBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgS AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEJ/DRMoS8UhK07EA/iV2B5e3r8t8/StJT38d x9YbuoSBmbYZJ6JHH9hoyv0hAPwMiH1M8zZUeQK/TQDqkg2Hjk0xL+U7i9ggocLJEAWQDbg4BGVh CBISCisGAQQBl1UBBQEBB0BqHjRRmoXeZmeeUZOqL1ebAflzYFA3jHwxl2sLMLlMCgMBCAeIeAQY FggAIBYhBIz5DCBmNX0gES3QOJ/DRMoS8UhKBQJlYQgSAhsMAAoJEJ/DRMoS8UhK4o0BAOB7ChkN Jc0oxRDg9WvrbUCnpLU/QdjMFcC8ymLRdzxaAP4gZVL0JQfxulc/JAxotCevk1PAF+UXpY8QalTI dooaAA== Date: Fri, 17 May 2024 22:23:50 +0200 Message-ID: <87v83cfaqx.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2600:3c02:e000:179::7; envelope-from=sandra.snan@HIDDEN; helo=halsen.idiomdrottning.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) Hi y'all. flow-fill.el.gz has a pair of functions, fill-flowed-encode and=20 fill-flowed-fill-buffer (the latter is only called from the=20 former). Here is a fixed version of the former that then also deprecates=20 the latter (I have signed FSF copyright papers): (defun fill-flowed-encode (&optional buffer) (with-current-buffer (or buffer (current-buffer)) ;; No point in doing this unless hard newlines is used. (when use-hard-newlines (let ((start (point-min)) end) ;; Go through each paragraph, filling it and adding SPC ;; as the last character on each line. (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)) (prefix (concat "\n" (or (and (looking-at ">[> ]*") (match-string 0)) "")))) (while (search-forward prefix nil t) (replace-match " " t t)) (goto-char start) (while (< (+ (point) fill-column) (point-max)) (forward-char fill-column) (search-backward " ") (forward-char) (insert prefix))) (setq start (1+ (point-max)))))) t))) This fixes two bugs when sending RFC 2646=E2=80=93formatted email. First, the old code didn't refill or encode the last paragraph at=20 all unless there was at least one hard newline EOF. Second, the old code borked up code indented with tabs and spaces=20 (iff that code had overly long lines), such as the Lisp code in=20 this email. It could sometimes insert extra in the middle of such=20 long lines. Here is an example of what it would do. It would turn this: (defun lorem (ipsum) (dolor sit amet) (consectetur adipiscing elit (sed do eiusmod tempor incididunt=20 ut labore et dolore magna aliqua)) (ut enim ad minim veniam (quis nostrud exercitation ullamco laboris nisi ut aliquip=20 ex ea commodo consequat (duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur) excepteur sint occaecat cupidatat non proident (sunt in culpa qui officia deserunt mollit anim id est=20 laborumd)))) into this: (defun lorem (ipsum) (dolor sit amet) (consectetur adipiscing elit (sed do eiusmod tempor incididunt ut labore et dolore magna aliqua)) (ut enim ad minim veniam (quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat (duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur) excepteur sint occaecat cupidatat non proident (sunt in culpa qui officia deserunt mollit anim id est laborumd)))) It was breaking lines awkwardly so when they're reconnected they=20 have extra whitespace in the mkddle of lines.=20
Sandra Snan <sandra.snan@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#71017
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.