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

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

Re: placing cursor at *start* of match in incremental search


From: Ittay Dror
Subject: Re: placing cursor at *start* of match in incremental search
Date: 26 Jan 2003 12:24:06 +0200

On Sun, 2003-01-26 at 11:47, Ittay Dror wrote:
> On Sun, 2003-01-26 at 08:28, Ittay Dror wrote:
> > On Thu, 2003-01-23 at 15:58, Maciej Kalisiak wrote:
> > > On Thu, Jan 23, 2003 at 07:58:46AM +0200, Ittay Dror wrote:
> > > > here are my 2c:
> > > > (defadvice isearch-search (after put-cursor-at-beginning last act)
> > > >   (if isearch-success (goto-char (match-beginning 0))))
> > > > 
> > > > (defadvice isearch-repeat (before put-cursor-at-end first act)
> > > >   (goto-char  (match-end 0)))
> > > > 
> > > > this will put the cursor at the start of the search *while* searching.
> > > > seems less confusing to me.
> > > 
well i found a bug there. the problem is that the match changes between
the calls to the two functions (probably the lazy highlight loop). so
here is the (very simple) fix:
(defvar isearch-match-end "Match end of current isearch" 0)

(defadvice isearch-search (after put-cursor-at-beginning last act)
  (if isearch-success
          (progn
                (setq isearch-match-end (point))
                (goto-char (match-beginning 0))
                )))

(defadvice isearch-repeat (before put-cursor-at-end first act)
  (goto-char  isearch-match-end))

-- 
===================================
Ittay Dror (ittay@qlusters.com)
User Space Team, R&D
Qlusters Inc.
+972-3-6081976 Fax: +972-3-6081841





reply via email to

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