help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: Scrolling text erases the search highlight


From: Drew Adams
Subject: RE: Scrolling text erases the search highlight
Date: Fri, 23 Jul 2010 07:21:51 -0700

> >> I am limited to scrolling the buffer that is near
> >> a result of the searched text, and if I try to move the
> >> cursor away in order to scroll more or just to
> >> change some text around it will erase the search too (and 
> >> I come back with the original problem again). Any idea to
> >> how to solve that?
> >
> > As far as I know, there is no way to get around that 
> > problem today. I think the main issue is that in Emacs
> > point is always in the visible portion of the buffer.
> 
> IMHO there is a way,
> making functions doing de-highlighting conditional
> (unless (or (eq last-command-event 'next)
>            (eq last-command-event 'prior))
> 
> for example
> (defun isearch-dehighlight ()
>    (unless (or (eq last-command-event 'next)
>                (eq last-command-event 'prior))
>    (when isearch-overlay
>      (delete-overlay isearch-overlay))))
> 
> same with lazy-highlight-cleanup and maybe some more.
> Produces visible effect here.
> Some more/other will arise nonetheless:
> isearch highlighting is done in visible portion of buffer only.
> Starting scroll with both changes as above will keep the 
> highlights set so far, but not highlight further, now scrolled
> portion.

In addition to some of the other suggestions, you can try Icicles search,
including `icicle-occur'.  You can keep the highlighting after searching (toggle
that on/off with `C-.' during search).  And you can scroll anywhere during
search (or afterward) - point is not tied to a search hit when you move the
focus from the minibuffer to your search-hits buffer.

This kind of search is quite different, so you will want to read up on it - do
not expect the same thing you are used to with isearch.

Essentially, all search hits are found for an initial regexp, and they are
presented to you as completion candidates.  You can navigate among the hits, and
you can narrow the set of hits by typing input that the candidates must also
match.  (IOW, you can search within the set of search hits.)

`icicle-occur' is a simplified version of this where the initial regexp is just
`.*', which matches all text in each line.  `icicle-occur' is on `C-''.
`icicle-search' (more general) is on `C-`'.

http://www.emacswiki.org/emacs/Icicles_-_Search_Commands%2c_Overview




reply via email to

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