diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2019-07-13 01:09:19 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2019-07-13 01:09:25 +0200 |
commit | ebd3f61a569f256f926828017f500cc74e6878bc (patch) | |
tree | cca320097c91903e23419cff0ea70b63d89585ea /lisp/mail | |
parent | 38e420af451c61dd0e77c7d73adf6fd1f6a021a9 (diff) | |
download | emacs-ebd3f61a569f256f926828017f500cc74e6878bc.tar.gz |
Fold rfc2047 headers correctly when narrowed to header value
* lisp/mail/rfc2047.el (rfc2047-fold-region): Fold headers
correctly if narrowed to the header value.
Diffstat (limited to 'lisp/mail')
-rw-r--r-- | lisp/mail/rfc2047.el | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el index e3315120d82..a02201ec323 100644 --- a/lisp/mail/rfc2047.el +++ b/lisp/mail/rfc2047.el @@ -732,12 +732,19 @@ Point moves to the end of the region." (save-restriction (narrow-to-region b e) (goto-char (point-min)) - (let ((break nil) - (qword-break nil) - (first t) - (bol (save-restriction - (widen) - (point-at-bol)))) + (let* ((break nil) + (qword-break nil) + (bol (save-restriction + (widen) + (line-beginning-position))) + ;; This function is either called with the Header: name in + ;; the region or not. If it's not in the region, then we + ;; may already have a space. + (first (or (= bol (point)) + (save-restriction + (widen) + (save-excursion + (not (re-search-backward "[ \t]" bol t))))))) (while (not (eobp)) (when (and (or break qword-break) (> (- (point) bol) 76)) |