* bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100%
@ 2010-06-06 3:36 Li Zhai
2010-06-06 9:54 ` Juri Linkov
0 siblings, 1 reply; 6+ messages in thread
From: Li Zhai @ 2010-06-06 3:36 UTC (permalink / raw)
To: 6362
Package: Emacs
Version: 23.2.1
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'.
I'm using Windows XP, Emacs version 23.2.
Bye,
Li Zhai
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100%
2010-06-06 3:36 bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100% Li Zhai
@ 2010-06-06 9:54 ` Juri Linkov
2010-06-06 12:30 ` Li Zhai
2010-06-07 18:09 ` Juri Linkov
0 siblings, 2 replies; 6+ messages in thread
From: Juri Linkov @ 2010-06-06 9:54 UTC (permalink / raw)
To: Li Zhai; +Cc: 6362
> 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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100%
2010-06-06 9:54 ` Juri Linkov
@ 2010-06-06 12:30 ` Li Zhai
2010-06-07 18:05 ` Juri Linkov
2010-06-07 18:09 ` Juri Linkov
1 sibling, 1 reply; 6+ messages in thread
From: Li Zhai @ 2010-06-06 12:30 UTC (permalink / raw)
To: Juri Linkov; +Cc: 6362
Yes, I expect that query-replace will rename file names start with
`f'. As the search process just matched the file names, it is a simple
thought that `^' means the beginning of the file name.
If we could add some special syntax properties to the white-space
before the file name, it is possible to match the file names start
with `f'. For instance, type :
dired-isearch-filenames-regexp RET \sxf RET
At here, the `x' means the special syntax class.
It's just my random thought. At most times, a white-space can solve my
problem, like `dired-isearch-filenames-regexp RET SPC f RET'.
On Sun, Jun 6, 2010 at 5:54 PM, Juri Linkov <juri@jurta.org> wrote:
>> 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/
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100%
2010-06-06 12:30 ` Li Zhai
@ 2010-06-07 18:05 ` Juri Linkov
0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2010-06-07 18:05 UTC (permalink / raw)
To: Li Zhai; +Cc: 6362
> Yes, I expect that query-replace will rename file names start with
> `f'. As the search process just matched the file names, it is a simple
> thought that `^' means the beginning of the file name.
>
> If we could add some special syntax properties to the white-space
> before the file name, it is possible to match the file names start
> with `f'. For instance, type :
>
> dired-isearch-filenames-regexp RET \sxf RET
>
> At here, the `x' means the special syntax class.
`\sx' matches a character, but it would be better to match the empty string
like `^' does.
One variant is to narrow the dired buffer so the beginning of a line
will be the beginning of a file name. Unfortunately, it's impossible
to narrow to columns, only to lines.
Another variant is to add a new predicate function in regex.c
that will specify where ^ should match, so dired will set it
to a function that returns non-nil at the beginning of a file name.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100%
2010-06-06 9:54 ` Juri Linkov
2010-06-06 12:30 ` Li Zhai
@ 2010-06-07 18:09 ` Juri Linkov
2011-09-09 15:49 ` Juri Linkov
1 sibling, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2010-06-07 18:09 UTC (permalink / raw)
To: 6362
> 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
BTW, there is another bug in query-replace lazy-highlighting in dired.
Wdired sets `query-replace-skip-read-only' to replace only in
file names, but during replacement all read-only matches are
lazy-highlighted too. This can be fixed with this patch:
=== modified file 'lisp/wdired.el'
--- lisp/wdired.el 2010-01-13 08:35:10 +0000
+++ lisp/wdired.el 2010-06-06 18:09:04 +0000
@@ -243,6 +243,8 @@ (defun wdired-change-to-wdired-mode ()
(buffer-substring (point-min) (point-max)))
(set (make-local-variable 'wdired-old-point) (point))
(set (make-local-variable 'query-replace-skip-read-only) t)
+ (set (make-local-variable 'isearch-filter-predicate)
+ 'wdired-isearch-filter-read-only)
(use-local-map wdired-mode-map)
(force-mode-line-update)
(setq buffer-read-only nil)
@@ -268,6 +270,11 @@ (defun wdired-change-to-wdired-mode ()
"Press \\[wdired-finish-edit] when finished \
or \\[wdired-abort-changes] to abort changes")))
+(defun wdired-isearch-filter-read-only (beg end)
+ "Skip matches that have a read-only property."
+ (and (isearch-filter-visible beg end)
+ (not (text-property-not-all (min beg end) (max beg end)
+ 'read-only nil))))
;; Protect the buffer so only the filenames can be changed, and put
;; properties so filenames (old and new) can be easily found.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100%
2010-06-07 18:09 ` Juri Linkov
@ 2011-09-09 15:49 ` Juri Linkov
0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2011-09-09 15:49 UTC (permalink / raw)
To: 6362-done
> BTW, there is another bug in query-replace lazy-highlighting in dired.
> Wdired sets `query-replace-skip-read-only' to replace only in
> file names, but during replacement all read-only matches are
> lazy-highlighted too. This can be fixed with this patch:
> [...]
> +(defun wdired-isearch-filter-read-only (beg end)
> + "Skip matches that have a read-only property."
> + (and (isearch-filter-visible beg end)
> + (not (text-property-not-all (min beg end) (max beg end)
> + 'read-only nil))))
I installed this old patch and closed this bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-09-09 15:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-06 3:36 bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100% Li Zhai
2010-06-06 9:54 ` Juri Linkov
2010-06-06 12:30 ` Li Zhai
2010-06-07 18:05 ` Juri Linkov
2010-06-07 18:09 ` Juri Linkov
2011-09-09 15:49 ` Juri Linkov
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.