From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Type Ahead Find Date: Sun, 20 Mar 2005 22:22:35 +0200 Organization: JURTA Message-ID: <87sm2qvzhx.fsf@jurta.org> References: <87k6o4eo2u.fsf@jurta.org> <874qf83a5i.fsf-monnier+emacs@gnu.org> <87psxvq11d.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1111353202 9395 80.91.229.2 (20 Mar 2005 21:13:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 20 Mar 2005 21:13:22 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 20 22:13:22 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DD7in-0005OZ-Sg for ged-emacs-devel@m.gmane.org; Sun, 20 Mar 2005 22:12:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DD7zl-00049p-Fq for ged-emacs-devel@m.gmane.org; Sun, 20 Mar 2005 16:30:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DD7wq-0001Bp-3h for emacs-devel@gnu.org; Sun, 20 Mar 2005 16:27:00 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DD7wl-00018k-2o for emacs-devel@gnu.org; Sun, 20 Mar 2005 16:26:56 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DD7wk-00014n-C9 for emacs-devel@gnu.org; Sun, 20 Mar 2005 16:26:54 -0500 Original-Received: from [199.232.41.67] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:RC4-SHA:128) (Exim 4.34) id 1DD7Zj-0005ww-66 for emacs-devel@gnu.org; Sun, 20 Mar 2005 16:03:07 -0500 Original-Received: from [194.126.101.98] (helo=MXR-4.estpak.ee) by mx20.gnu.org with esmtp (Exim 4.34) id 1DD7Fp-0003Ax-4b for emacs-devel@gnu.org; Sun, 20 Mar 2005 15:42:33 -0500 Original-Received: from mail.neti.ee (80-235-41-70-dsl.mus.estpak.ee [80.235.41.70]) by MXR-4.estpak.ee (Postfix) with ESMTP id 6EF4012D0C5; Sun, 20 Mar 2005 22:42:25 +0200 (EET) Original-To: Stefan Monnier In-Reply-To: <87psxvq11d.fsf@jurta.org> (Juri Linkov's message of "Sat, 19 Mar 2005 14:29:29 +0200") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:34846 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34846 Juri Linkov 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/