From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ittay Dror Newsgroups: gmane.emacs.help Subject: Re: placing cursor at *start* of match in incremental search Date: 26 Jan 2003 12:24:06 +0200 Organization: Qlusters Inc. Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <1043576646.1094.142.camel@rum> References: <3E2D7F8E.1050205@ihs.com> <1043301279.8748.31.camel@rum> <20030123135818.GA4232@khazad-dum> <1043562515.8748.104.camel@rum> <1043574470.8748.138.camel@rum> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1043576730 13415 80.91.224.249 (26 Jan 2003 10:25:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 26 Jan 2003 10:25:30 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18cjyi-0003UE-00 for ; Sun, 26 Jan 2003 11:25:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18cjzv-0003Wf-02 for gnu-help-gnu-emacs@m.gmane.org; Sun, 26 Jan 2003 05:26:43 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18cjzQ-0002y5-00 for help-gnu-emacs@gnu.org; Sun, 26 Jan 2003 05:26:12 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18cjyz-0001dV-00 for help-gnu-emacs@gnu.org; Sun, 26 Jan 2003 05:25:46 -0500 Original-Received: from adsl-161-92.barak.net.il ([62.90.161.92] helo=hirame.qlusters.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18cjyp-0001C2-00 for help-gnu-emacs@gnu.org; Sun, 26 Jan 2003 05:25:35 -0500 Original-Received: from [10.100.0.13] ([10.100.0.13]) by hirame.qlusters (8.10.2/8.10.2) with ESMTP id h0QAGje12292; Sun, 26 Jan 2003 12:16:45 +0200 Original-To: Maciej Kalisiak In-Reply-To: <1043574470.8748.138.camel@rum> X-Mailer: Ximian Evolution 1.2.0 (1.2.0-3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5963 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5963 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