[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: occur API change proposal
From: |
Juri Linkov |
Subject: |
Re: occur API change proposal |
Date: |
Sat, 01 Dec 2007 02:34:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) |
> I propose changing the occur API to allow an optional predicate
> function. For example, this is useful to invert a regular expression so
> you don't have to run occur on the whole buffer matching everything,
> then limit the results.
The occur engine currently hard-codes the function call of
`re-search-forward'. Instead of this, we could do the same
as is done already in isearch for customization of the search
function using a variable `isearch-search-fun-function', and
add a new analogous variable `occur-fun-function'.
Even though such a variable will be useful for other purposes,
no simple function will allow inverting a regular expression.
Implementing this feature requires significant modification in
the logic of the occur engine: either changing the algorithm to
call `looking-at' at every line (very inefficient), or recording
a position of the previous match and outputing lines between it
and the current position (not easy to customize).
--
Juri Linkov
http://www.jurta.org/emacs/