[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on re-search-forward and infinite loop
From: |
Lennart Borgman |
Subject: |
Re: Question on re-search-forward and infinite loop |
Date: |
Thu, 26 Nov 2009 22:11:24 +0100 |
On Thu, Nov 26, 2009 at 10:01 PM, David Maus <maus.david@gmail.com> wrote:
> Hi,
>
> By accident I stumpled on a way to force Emacs in a infinite loop with
> `re-search-forward'.
>
> If I create a shiny new buffer, insert something like this:
>
> ,----
> | (while (re-search-forward "^[ \t]*"))
> | Something else
> `----
>
> -- go back beyond the while-clause and evaluate it, Emacs enters an
> infinite loop. As far as I was able to find out
> `re-search-forward' with this regexp moves point to the beginning
> of the next line above the "S" of "Something else" and stays there
> forever so it never reaches end-of-buffer.
>
> As I dunno much (or better: anything) on Emacs' interiors my question
> is: Why does this happen?
If the match on next line is 0 chars long then it will not move forward.