[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ec6254e 2/2: Fix infloop when folding difficult headers in Messag
From: |
Lars Ingebrigtsen |
Subject: |
master ec6254e 2/2: Fix infloop when folding difficult headers in Message |
Date: |
Sun, 20 Sep 2020 18:27:31 -0400 (EDT) |
branch: master
commit ec6254e5527b2b0aa6d93d6c83873aa400c20db3
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix infloop when folding difficult headers in Message
* lisp/mail/rfc2047.el (rfc2047-fold-field): Return the end point.
* lisp/gnus/message.el (message--fold-long-headers): Use that to
reliably achieve progress.
---
lisp/gnus/message.el | 8 ++++----
lisp/mail/rfc2047.el | 6 ++++--
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 3e7e189..16f47c8 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -4843,10 +4843,10 @@ If you always want Gnus to send messages in one piece,
set
Each line should be no more than 79 characters long."
(goto-char (point-min))
(while (not (eobp))
- (when (and (looking-at "[^:]+:")
- (> (- (line-end-position) (point)) 79))
- (mail-header-fold-field))
- (forward-line 1)))
+ (if (and (looking-at "[^:]+:")
+ (> (- (line-end-position) (point)) 79))
+ (goto-char (mail-header-fold-field))
+ (forward-line 1))))
(defvar sendmail-program)
(defvar smtpmail-smtp-server)
diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el
index 234f319..4aa0c28 100644
--- a/lisp/mail/rfc2047.el
+++ b/lisp/mail/rfc2047.el
@@ -716,11 +716,13 @@ Point moves to the end of the region."
(goto-char e)))))
(defun rfc2047-fold-field ()
- "Fold the current header field."
+ "Fold the current header field.
+Return the new end point."
(save-excursion
(save-restriction
(rfc2047-narrow-to-field)
- (rfc2047-fold-region (point-min) (point-max)))))
+ (rfc2047-fold-region (point-min) (point-max))
+ (point-max))))
(defun rfc2047-fold-region (b e)
"Fold long lines in region B to E."