|
From: | Kevin Rodgers |
Subject: | Re: placing cursor at *start* of match in incremental search |
Date: | Wed, 22 Jan 2003 10:22:50 -0700 |
User-agent: | Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
Maciej Kalisiak wrote:
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?
Use the source: `C-g' is bound in isearch-mode-map to isearch-abort, which sets isearch-success to nil before calling isearch-done, which is what runs isearch-mode-end-hook. So you could check isearch-success before calling goto-char in the hook function. -- <a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>
[Prev in Thread] | Current Thread | [Next in Thread] |