Subject: bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100%

From: Juri Linkov <[email-masked]>
Date: Sun, 06 Jun 2010 12:54:55 +0300

> I use the command `dired-isearch-filenames-regexp' to find some files
> in a directory. I use the the anchor `^' to match the files start with
> something. Emacs is suspended and the CPU usage is 100%.Here is a
> transcript:
>
> 1. Open a directory in dired mode.
> 2. Input `M-x dired-isearch-filenames-regexp RET  ^ f RET'
>
> Emacs will suspend rather than match the file names start with `f'.

Thanks for the report.  I fixed looping in lazy-highlighting.
Now the loop in `isearch-lazy-highlight-search' is exactly like
in `isearch-search' that checks for the empty match (and
`isearch-lazy-highlight-update' takes care about forwarding
point to the next character in this case).

As for implementing matching at the beginning of file names with `^',
it seems this is not possible to do.  `re-search-forward' matches only
at the beginning of a line, not in the middle of a line.

You can observe the same problem with query-replace in wdired.
For instance, type:

1. M-x wdired-change-to-wdired-mode RET
2. M-x query-replace-regexp RET ^f RET replacement RET

Do you expect that query-replace will rename file names
that start with `f'?

-- 
Juri Linkov
http://www.jurta.org/emacs/