[Top][All Lists]

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

Re: Type Ahead Find

From: Juri Linkov
Subject: Re: Type Ahead Find
Date: Sun, 20 Mar 2005 22:22:35 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/22.0.50 (gnu/linux)

Juri Linkov <address@hidden> 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)
         (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

reply via email to

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