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

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

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


From: Juri Linkov
Subject: bug#19004: 24.4; Please provide a non-regexp interface to occur
Date: Sun, 09 Nov 2014 22:49:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

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





reply via email to

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