all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Chris F.A. Johnson" <cfajohnson@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Is there an easier way to jump to the same word?
Date: Thu, 11 Apr 2013 04:22:12 -0400	[thread overview]
Message-ID: <ke8i3a-sc.ln1@cfa.johnson> (raw)
In-Reply-To: d56i3a-39s.ln1@cfa.johnson

On 2013-04-11, Chris F.A. Johnson wrote:
> On 2013-04-11, Steven Degutis wrote:
>> --047d7b67031bbb272504da0c7ba5
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> Often times I find that I want to jump to another occurrence of the
>> word-under-point, almost always variables or functions. I end up going to
>> the beginning of the word with M-b, doing isearch-forward with C-s, adding
>> all the words until the full word is the search term with C-w a bunch of
>> times, and finally C-s to jump around to other instances of it.
>>
>> Is there a better way to do this?
>
>    This is what I use:
>
> (defun current-word-search ()
>     "search forward for word under cursor"
>     (interactive)
>     (word-search-forward (current-word)))

  And to search backwards:

(defun current-word-reverse-search ()
    "search backwards for word under cursor"
    (interactive)
    (word-search-backward (current-word)))

  And, of course, they are bound to keys:

(global-set-key (kbd "s-s") 'current-word-search)
(global-set-key (kbd "s-r") 'current-word-reverse-search)


-- 
   Chris F.A. Johnson                          <http://cfajohnson.com>
   Author:                                     =======================
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)


  parent reply	other threads:[~2013-04-11  8:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.23929.1365647063.855.help-gnu-emacs@gnu.org>
2013-04-11  7:43 ` Is there an easier way to jump to the same word? Chris F.A. Johnson
2013-04-11  7:57   ` Damien Wyart
2013-04-11  8:22   ` Chris F.A. Johnson [this message]
2013-04-11 14:05     ` Steven Degutis
     [not found]       ` <878v4omosz.fsf@casenave-pere.fr>
2013-04-12  5:50         ` Renaud Casenave-Péré
2013-04-11  2:24 Steven Degutis
2013-04-11  7:11 ` Andreas Röhler
2013-04-11  7:35 ` Le Wang
2013-04-11 13:39   ` Jambunathan K
2013-04-11 14:09     ` Steven Degutis
2013-04-11 14:06   ` Steven Degutis
2013-04-11  8:04 ` Bastien
2013-04-11 14:13   ` Steven Degutis
2013-04-13  0:19     ` Bastien
2013-04-13  0:22       ` Steven Degutis
2013-04-11 13:42 ` Jambunathan K
2013-04-11 14:08   ` Steven Degutis
2013-04-11 17:06     ` Jambunathan K

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=ke8i3a-sc.ln1@cfa.johnson \
    --to=cfajohnson@gmail.com \
    --cc=help-gnu-emacs@gnu.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.