all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <sj10@cs.brown.edu>, <help-gnu-emacs@gnu.org>
Subject: RE: cursor position upon search
Date: Sun, 28 Feb 2010 14:51:39 -0800	[thread overview]
Message-ID: <DE0F7277A6844B4A9F03166890116149@us.oracle.com> (raw)
In-Reply-To: <8a8343a11002271105r3300a452o6ed57f367d77402c@mail.gmail.com>

> 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





      reply	other threads:[~2010-02-28 22:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-27 19:05 cursor position upon search sj10
2010-02-28 22:51 ` Drew Adams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DE0F7277A6844B4A9F03166890116149@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=sj10@cs.brown.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.