[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21615: 24.5; font-lock-extend-region-wholelines' infinite loop
From: |
Eli Zaretskii |
Subject: |
bug#21615: 24.5; font-lock-extend-region-wholelines' infinite loop |
Date: |
Fri, 09 Oct 2015 11:14:15 +0300 |
> From: brubar.cs@gmail.com
> Date: Sun, 04 Oct 2015 19:34:07 +0200
>
>
> The function `font-lock-extend-region-wholelines' uses `bolp' to check
> if point is at the beginning of the line, and, if not, it calls
> `line-beginning-position' to move to the beginning of the line.
>
> Here is the code from `font-lock-extend-region-wholelines':
>
> ,----
> | (goto-char font-lock-beg)
> | (unless (bolp)
> | (setq changed t font-lock-beg (line-beginning-position)))
> `----
>
>
> But, `line-beginning-position' moves to the beginning of the line *OR*
> to the beginning of a *field*. Thus, if point is at the beginning of a
> field that is not at the beginning of a line, `changed' is set to t but
> the region is not changed. As `font-lock-extend-region-wholelines' is
> called again until it doesn't signal a change, we end up in an infinite
> loop.
>
>
>
> To reproduce, use the attached file and run it like that:
>
>
> ,----
> | emacs -Q --file test-font-lock-infloop.el --eval '(progn (eval-buffer)
> (DO-NOT-EVAL-ME))'
> `----
Thanks, I fixed that in the development sources.