[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#47338: 28.0.50; Unexpected error in fill-region
From: |
Eli Zaretskii |
Subject: |
bug#47338: 28.0.50; Unexpected error in fill-region |
Date: |
Tue, 23 Mar 2021 20:05:49 +0200 |
> From: Evgeny Zajcev <lg.zevlg@gmail.com>
> Date: Tue, 23 Mar 2021 12:43:20 +0300
>
> Evaluating next sexp results in error:
> (with-temp-buffer
> (let ((fill-column 66))
> (insert " :action (lambda (docid msg
> target)")
> (fill-region (point-min) (point-max) 'left t)
> (buffer-string)))
>
> Here is the backtrace:
> Debugger entered--Lisp error: (error "Invalid search bound (wrong side of
> point)")
> re-search-backward("[ \11]\\|\\c|.\\|.\\c|" 71 0)
> fill-move-to-break-point(71)
> fill-region-as-paragraph(1 70 left t)
> fill-region(1 70 left t)
> (let ((fill-column 66)) (insert "
> :action (lambda...") (fill-region (point-min) (point-max)
> 'left t) (buffer-string))
> ...
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.