aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/mail
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-07-12 15:59:27 +0200
committerLars Ingebrigtsen2019-07-12 15:59:27 +0200
commit4c4ff9d90aa040ef3e1e474b3aa6a29f54c88e2e (patch)
tree7e6582f588f85620bc579be4a3e001d56996f208 /lisp/mail
parent4438459eaa6cccdac2cfcc8f7d5f248bfe8d1edf (diff)
downloademacs-4c4ff9d90aa040ef3e1e474b3aa6a29f54c88e2e.tar.gz
emacs-4c4ff9d90aa040ef3e1e474b3aa6a29f54c88e2e.zip
Fix breaking of rfc2047 headers with long words
* lisp/mail/rfc2047.el (rfc2047-fold-region): Don't break lines right after the Header: field, but wait until the next whitespace. (This only makes a difference for words that are very long (i.e., longer than, say, 60 characters, depending on the header name length.)
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/rfc2047.el7
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el
index 9de6f02edfb..e3315120d82 100644
--- a/lisp/mail/rfc2047.el
+++ b/lisp/mail/rfc2047.el
@@ -765,7 +765,9 @@ Point moves to the end of the region."
765 ;; Whitespace -- possible break point. 765 ;; Whitespace -- possible break point.
766 ((memq (char-after) '(? ?\t)) 766 ((memq (char-after) '(? ?\t))
767 (skip-chars-forward " \t") 767 (skip-chars-forward " \t")
768 (unless first ;; Don't break just after the header name. 768 ;; Don't break just after the header name.
769 (if first
770 (setq first nil)
769 (setq break (point)))) 771 (setq break (point))))
770 ;; If the header has been encoded (with RFC2047 encoding, 772 ;; If the header has been encoded (with RFC2047 encoding,
771 ;; which looks like "=?utf-8?Q?F=C3=B3?=". 773 ;; which looks like "=?utf-8?Q?F=C3=B3?=".
@@ -780,8 +782,7 @@ Point moves to the end of the region."
780 (skip-chars-forward "^ \t\n\r"))) 782 (skip-chars-forward "^ \t\n\r")))
781 ;; Look for the next LWSP (i.e., whitespace character). 783 ;; Look for the next LWSP (i.e., whitespace character).
782 (t 784 (t
783 (skip-chars-forward "^ \t\n\r"))) 785 (skip-chars-forward "^ \t\n\r"))))
784 (setq first nil))
785 (when (and (or break qword-break) 786 (when (and (or break qword-break)
786 (> (- (point) bol) 76)) 787 (> (- (point) bol) 76))
787 ;; Finally, after the loop, we have a line longer than 76 788 ;; Finally, after the loop, we have a line longer than 76