[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Juri Linkov
Subject: bug#6362: Emacs command `dired-isearch-filenames-regexp' cause CPU usage 100%
Date: Mon, 07 Jun 2010 21:09:42 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

> 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)
   (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]