From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org
Subject: Re: isearch and yank word doubt
Date: Fri, 31 May 2013 09:32:34 +0200 [thread overview]
Message-ID: <86k3mf61v1.fsf@somewhere.org> (raw)
In-Reply-To: mailman.745.1369976220.22516.help-gnu-emacs@gnu.org
Hi Kevin,
Kevin Rodgers wrote:
> On 5/30/13 12:42 AM, Luca Ferrari wrote:
>> Hi all,
>> according to the manual the C-s C-w yanks the next word the cursor is
>> on as the string to search with isearch. Often I found myself having
>> the cursor in the middle of a word, so I have to go back to the
>> beginning and then do the yank, is there a better way to instrument
>> C-s C-w to get the word the cursor is in?
>
> I like it!
>
> (defun isearch-yank-word-at-point ()
> "Pull the word around point from buffer into search string."
> (interactive)
> ;; see isearch-yank-word-or-char and isearch-yank-internal:
> (isearch-yank-string
> (save-excursion
> (when (and (not isearch-forward) isearch-other-end)
> (goto-char isearch-other-end))
> (when (= (char-syntax (or (char-after (1- (point))) 0)) ?w)
> (forward-word -1))
> (buffer-substring-no-properties (point)
> (progn (forward-word 1) (point))))))
>
> (define-key isearch-mode-map "\C-w" 'isearch-yank-word-at-point)
One detail I don't like in the above: when C-s C-w'ing, it directly jumps to
the next occurrence of the searched string. I find it'd be better if it'd stay
on the current word, highlighting it completely.
Best regards,
Seb
--
Sebastien Vauban
next prev parent reply other threads:[~2013-05-31 7:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 6:42 isearch and yank word doubt Luca Ferrari
2013-05-31 4:57 ` Kevin Rodgers
[not found] ` <mailman.745.1369976220.22516.help-gnu-emacs@gnu.org>
2013-05-31 7:32 ` Sebastien Vauban [this message]
2013-05-31 8:30 ` Kevin Rodgers
[not found] ` <mailman.751.1369988981.22516.help-gnu-emacs@gnu.org>
2013-05-31 10:38 ` Sebastien Vauban
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=86k3mf61v1.fsf@somewhere.org \
--to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
--cc=help-gnu-emacs-mXXj517/zsQ@public.gmane.org \
/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.