Subject: Re: bug#34387: 26.1; Gnus: handle empty message parts

From: Christophe Troestler <[email-masked]>
Date: Wed, 13 Feb 2019 18:26:44 +0100

On 13 February 2019 at 05:53 CET, Katsumi Yamaoka wrote:
>
> […] If it is (narrow-to-region beg (point)) in gnus-mime-display-single to issue (args-out-of-range 4409 4410), I guess an html rendering function deletes buffer's contents so that the buffer's end point may be 4409.  Here is a model to reproduce the same error:
>
> (with-temp-buffer               ;; article buffer
>   (insert-char ?x 4409)
>   (let ((beg (point)))          ;; buffer's end point == 4410
>     (delete-char -1)            ;; html function does this
>     (narrow-to-region beg (point))))
>  => (args-out-of-range 4409 4410)
>
> The default html function is mm-shr, that gnus-mime-display-single calls by way of mm-display-part, mm-display-inline, and mm-inline-text-html.  At that time, the point is positioned at the end of the article buffer, where the header lines and a single empty line are there.

Thanks for your analysis.  I indeed had an advice executed after mm-shr to remove trailing whitespace—these making sometimes the rendered text hard to read.  Deleting the advice makes the call work.

What approach would you recommend to remove trailing whitespace after rendering HTML?

Best,
C.