Guard against faulty flow-filled emails

* lisp/mail/flow-fill.el (fill-flowed): Don't bug out if there's a
space at the end of the buffer.  This is probably not allowed in
the flow-fill specification, but has been observed in the wild.
This commit is contained in:
Lars Ingebrigtsen 2020-09-11 16:45:12 +02:00
parent b054393dd1
commit d608eb1c94

View file

@ -157,7 +157,8 @@ lines."
;; Hack: Don't do the flowing on the signature line.
(when (and (not (looking-at "-- $"))
(eq (char-before (line-end-position)) ?\s))
(while (eq (char-before (line-end-position)) ?\s)
(while (and (not (eobp))
(eq (char-before (line-end-position)) ?\s))
(end-of-line)
(when delete-space
(delete-char -1))