From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: cursor position upon search Date: Sun, 28 Feb 2010 14:51:39 -0800 Message-ID: References: <8a8343a11002271105r3300a452o6ed57f367d77402c@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1267397642 31656 80.91.229.12 (28 Feb 2010 22:54:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 28 Feb 2010 22:54:02 +0000 (UTC) To: , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 28 23:53:58 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nls1K-0001Yx-B4 for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Feb 2010 23:53:58 +0100 Original-Received: from localhost ([127.0.0.1]:33457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nls18-0005Ht-OB for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Feb 2010 17:53:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nlrzl-0004Ab-Jd for help-gnu-emacs@gnu.org; Sun, 28 Feb 2010 17:52:17 -0500 Original-Received: from [140.186.70.92] (port=47142 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nlrzj-00049b-OE for help-gnu-emacs@gnu.org; Sun, 28 Feb 2010 17:52:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nlrzh-0002LR-SR for help-gnu-emacs@gnu.org; Sun, 28 Feb 2010 17:52:14 -0500 Original-Received: from rcsinet11.oracle.com ([148.87.113.123]:28984) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nlrzh-0002LF-Lm for help-gnu-emacs@gnu.org; Sun, 28 Feb 2010 17:52:13 -0500 Original-Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rcsinet11.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o1SMqAj6000586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 28 Feb 2010 22:52:11 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o1SMq5ZQ001527; Sun, 28 Feb 2010 22:52:10 GMT Original-Received: from abhmt021.oracle.com by acsmt354.oracle.com with ESMTP id 55292381267397497; Sun, 28 Feb 2010 14:51:37 -0800 Original-Received: from dradamslap1 (/24.5.179.75) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 28 Feb 2010 14:51:37 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <8a8343a11002271105r3300a452o6ed57f367d77402c@mail.gmail.com> Thread-Index: Acq4xaM5/8GWCC/7RmeKq5c8B9QfzQAAGIiw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: acsmt353.oracle.com [141.146.40.153] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090205.4B8AF39A.00E2:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72253 Archived-At: > If the search string is "arg", then is there a command in > emacs to place the cursor on the first character of arg > when it is found rather than 1 past the last character > as search-forward for instance does? 1. I assume you're asking about interactive use of Isearch (even though you asked about `search-forward'). See `isearch-mode-end-hook' and variable `isearch-other-end'. The latter is the position you want to go to. The former gives you a way to go there: (defun foo () (goto-char isearch-other-end)) (add-hook 'isearch-mode-end-hook 'foo) 2. If you really meant `search-forward' and you are using this in Lisp code, then after calling `search-forward' just (goto-char (match-beginning 0)). 3. If what you really want is to select the search hit, then see library `isearch+.el' - option `isearchp-set-region-flag' determines this behavior. You can use `C-SPC' during Isearch to toggle the behavior. http://www.emacswiki.org/emacs/IsearchPlus