Subject: Re: bug#19004: 24.4; Please provide a non-regexp interface to occur

From: Juri Linkov <[email-masked]>
Date: Sun, 09 Nov 2014 22:49:50 +0200

> I like occur a lot, but I find it inflexible -- the matched lines can only
> be specified by a regexp.  I'd like to be aple to pass a function to occur
> instead of a regexp.
>
> The function should be called with point at the beginning of a line to
> match/not match, so that
>
>   (occur regexp)
>
> is equivalent to
>
>   (occur #'(lambda () (looking-at regexp)))
>
> Of course, the function should be able to examine the context around the
> line being matched.

At the core of the Occur engine there is the function re-search-forward.
We could move it out to a separate variable e.g. occur-search-function
(as we do for isearch-search-fun-function).  Then you will be able to
override it with your own like

  (let ((occur-search-function 'word-search-forward))
    (occur string))