[Top][All Lists]

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

Re: Lazy Isearch in dired

From: Juri Linkov
Subject: Re: Lazy Isearch in dired
Date: Thu, 13 Nov 2008 18:30:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

>>> The following patch fixes this by using a loop like the loop in the
>>> function `isearch-search'.  The docstring of isearch-lazy-highlight-search
>>> says: "Attempt to do the search exactly the way the pending isearch would.",
>>> so no changes in the docstring are needed, because this patch makes it
>>> more similar to the main search function.  It also calls 
>>> isearch-success-function
>>> to skip the matches outside the current Isearch scope.  By default this
>>> function skips invisible matches that are useless for lazy highlighting.
>>> This also requires setting search-invisible to nil to not match
>>> invisible text.
>> Hmm, your patch looks reasonable, but I'm not sure.  Could it possibly
>> lead to slowdowns in some buffers from the additional search loop?
>> Maybe we should hold this till after the release.
> Ah, I see you already installed it.  That's OK.

In normal cases there is no slowdown because the new additional
loop gets executed only once.  And in cases with a restricted search
(with invisible matches or matches outside of the search space)
there is really a speedup instead of slowdown because unnecessary
overlays for lazy highlights never get created - these places are
skipped with a new loop.

> Could you do some quick testing to make sure there isn't a slowdown?
> (e.g., try searching in a buffer in a way that generates lots of lazy
> highlights).

The quickest way to test is to open the etc/NEWS file and

1. expand all outlines with `C-c C-a' and type `C-M-s .'
   the time required to highlight all matched is the same as before;

2. hide everything but the top levels with `C-1 C-c C-q' and type `C-M-s .'
   then highlighting now is much faster than before because it now
   doesn't create unnecessary overlays on matches in hidden regions.

Juri Linkov

reply via email to

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