[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: placing cursor at *start* of match in incremental search
From: |
Maciej Kalisiak |
Subject: |
Re: placing cursor at *start* of match in incremental search |
Date: |
22 Jan 2003 14:41:32 GMT |
User-agent: |
slrn/0.9.7.4 (Linux) |
* Kevin Rodgers <kevin.rodgers@ihs.com>:
> Maciej Kalisiak wrote:
>
> > * Greg Hill <ghill@synergymicro.com>:
> >
> >> Put this in your .emacs:
> >>
> >> (add-hook 'isearch-mode-end-hook
> >> (function (lambda () (goto-char (match-beginning 0)))))
> >>
> >
> > Ah, perfect! Thanks.
> >
> > Is this approach better, or Adrian's method of using "advice"? (I have only
> > limited elisp knowledge, and not much experience with advice functions)
>
>
> I'm a big fan of defadvice, but I think it should only be used when there's
> no other way to get the behavior you want. If there's a hook available, use
> that; and better yet, if there's a user option, use that.
Played around a bit with both approaches, and it seems the "defadvice" method
is the better of the two, at least as presented so far. The probelm with the
hook method, as shown above, is that it breaks the behaviour of an isearch
abortion. Usually, on a C-g the cursor goes back to where it was when C-s was
pressed; with the hook form above it is placed at the first character of the
match... seems the hook is called on *all* methods of ending an isearch. OTOH,
the defadvice form works properly.
Can the hook form be somehow coaxed to do abortion properly?
--
Maciej Kalisiak | <mac@dgp.toronto.edu> | http://www.dgp.toronto.edu/~mac [McQ]
PGP->finger|www; (0x39AC36F5) 9F BB 9E 11 F0 1E 5D 20 0B 31 3D 37 47 D0 67 C7
- Re: placing cursor at *start* of match in incremental search, (continued)
- Re: placing cursor at *start* of match in incremental search, Stefan Monnier <address@hidden>, 2003/01/16
- Re: placing cursor at *start* of match in incremental search, Kevin Rodgers, 2003/01/16
- Re: placing cursor at *start* of match in incremental search, Adrian Kubala, 2003/01/16
- Re: placing cursor at *start* of match in incremental search, Greg Hill, 2003/01/16
- Re: placing cursor at *start* of match in incremental search, David Robinow, 2003/01/16
- Message not available
- Re: placing cursor at *start* of match in incremental search, Maciej Kalisiak, 2003/01/17
- Re: placing cursor at *start* of match in incremental search, Greg Hill, 2003/01/17
- Re: placing cursor at *start* of match in incremental search, Kevin Rodgers, 2003/01/21
- Re: placing cursor at *start* of match in incremental search,
Maciej Kalisiak <=
- Re: placing cursor at *start* of match in incremental search, Kevin Rodgers, 2003/01/22
- Re: placing cursor at *start* of match in incremental search, Greg Hill, 2003/01/22
- Message not available
- Re: placing cursor at *start* of match in incremental search, Stefan Monnier <address@hidden>, 2003/01/22
- Message not available
- Re: placing cursor at *start* of match in incremental search, Kevin Rodgers, 2003/01/22
- Re: placing cursor at *start* of match in incremental search, Ittay Dror, 2003/01/23
- Re: placing cursor at *start* of match in incremental search, Maciej Kalisiak, 2003/01/23
- Re: placing cursor at *start* of match in incremental search, Ittay Dror, 2003/01/26
- Re: placing cursor at *start* of match in incremental search, Ittay Dror, 2003/01/26
- Re: placing cursor at *start* of match in incremental search, Ittay Dror, 2003/01/26