unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: Type Ahead Find
Date: Sun, 20 Mar 2005 22:22:35 +0200	[thread overview]
Message-ID: <87sm2qvzhx.fsf@jurta.org> (raw)
In-Reply-To: <87psxvq11d.fsf@jurta.org> (Juri Linkov's message of "Sat, 19 Mar 2005 14:29:29 +0200")

Juri Linkov <juri@jurta.org> writes:
> (set (make-local-variable 'isearch-success-function)
>      ;; isearch only in function names
>      (lambda ()
>        (save-match-data
> 	 (let* ((re (cdr (assoc nil imenu-generic-expression))))
> 	   (and (save-excursion (beginning-of-line) (looking-at (car re)))
> 		(>= (point) (match-beginning (cadr re)))
> 		(<= (point) (match-end (cadr re))))))))

I noticed that `(point)' is not a reliable indicator to find
a matching point.  It seems better to give two arguments
(match-beginning 0) and (match-end 0) to `isearch-success-function'.
So a correct example would be:

(set (make-local-variable 'isearch-success-function)
     ;; isearch only in function names
     (lambda (mb me)
       (save-match-data
	 (let ((re (cdr (assoc nil imenu-generic-expression))))
	   (and (save-excursion (beginning-of-line) (looking-at (car re)))
		(>= mb (match-beginning (cadr re)))
		(<= me (match-end (cadr re))))))))

-- 
Juri Linkov
http://www.jurta.org/emacs/

  parent reply	other threads:[~2005-03-20 20:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-18 19:45 Type Ahead Find Juri Linkov
2005-03-18 20:21 ` Drew Adams
2005-03-18 21:53 ` Stefan Monnier
2005-03-19 12:29   ` Juri Linkov
2005-03-19 21:19     ` Miles Bader
2005-03-19 22:09       ` David Kastrup
2005-03-19 23:33         ` Miles Bader
2005-03-20 20:17           ` Juri Linkov
2005-03-20 21:46             ` David Kastrup
2005-03-20 22:04               ` Miles Bader
2005-03-21 19:28               ` Juri Linkov
2005-03-20 20:14       ` Juri Linkov
2005-03-20 20:22     ` Juri Linkov [this message]
2005-03-20  0:22 ` Richard Stallman
2005-03-20 20:19   ` Juri Linkov

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=87sm2qvzhx.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    /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).