unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Ted Zlatanov <tzz@lifelogs.com>
Cc: emacs-devel@gnu.org
Subject: Re: occur API change proposal
Date: Sat, 01 Dec 2007 02:34:35 +0200	[thread overview]
Message-ID: <87fxyni898.fsf@jurta.org> (raw)
In-Reply-To: <861wa92g6a.fsf@lifelogs.com> (Ted Zlatanov's message of "Thu, 29 Nov 2007 10:02:37 -0600")

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

  reply	other threads:[~2007-12-01  0:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 16:02 occur API change proposal Ted Zlatanov
2007-12-01  0:34 ` Juri Linkov [this message]
2008-08-05 18:49   ` add INVERT to re-search-{forward, backward} (was: occur API change proposal) Ted Zlatanov
2008-08-25 15:45     ` Juri Linkov
2008-08-25 15:57       ` add INVERT to re-search-{forward, backward} Lennart Borgman (gmail)
2008-08-25 19:45         ` Juri Linkov
2008-08-25 20:07           ` Lennart Borgman (gmail)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fxyni898.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=tzz@lifelogs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).