Subject: Re: bug#47338: 28.0.50; Unexpected error in fill-region

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 24 Mar 2021 10:24:48 +0100

Eli Zaretskii <[email-masked]> writes:

> This is the result of fixing bug#45720.  In the above scenario, the
> first time through the loop LINEBEG in the fragment below is set to
> EOB+1 instead of the point where the fill-prefix ends:
>
> 	(let ((first t)
>               linebeg)
> 	  (while (< (point) to)
>             ;; On the first line, there may be text in the fill prefix
>             ;; zone.  In that case, don't consider that area when
>             ;; trying to find a place to put a line break (bug#45720).
>             (if (not first)
> 	        (setq linebeg (point))
>               (setq first nil
>                     linebeg (+ (point) (length fill-prefix)))) <<<<<<<<<<
>
> CC'ing Lars who made that change.

Right...  the change tried to fix the case where there's a pre-computed
fill prefix being passed in.  In this bug, however, the prefix is
computed, and this logic shouldn't be done here.  I've now fixed this in
Emacs 28, but I'm still not quite sure about the original fix...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no