* Is there an easier way to jump to the same word?
@ 2013-04-11 2:24 Steven Degutis
2013-04-11 7:11 ` Andreas Röhler
` (3 more replies)
0 siblings, 4 replies; 18+ messages in thread
From: Steven Degutis @ 2013-04-11 2:24 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 398 bytes --]
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?
-Steven
[-- Attachment #2: Type: text/html, Size: 470 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-11 2:24 Steven Degutis
@ 2013-04-11 7:11 ` Andreas Röhler
2013-04-11 7:35 ` Le Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 18+ messages in thread
From: Andreas Röhler @ 2013-04-11 7:11 UTC (permalink / raw)
To: help-gnu-emacs
Am 11.04.2013 04:24, schrieb Steven Degutis:
> 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?
>
> -Steven
>
Made a ar-name-atpt for this, which picks just the identifiers.
Behind identifiers is a
defcustom ar-name-chars-atpt "a-zA-Z_;-"
Once in kill-ring, start search C-s and yank it back for search M-y
Source:
thing-at-point-utils.el
https://launchpad.net/s-x-emacs-werkstatt/trunk/1.3/+download/S-X-Emacs-Werkstatt-1.3.tar.gz
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
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:06 ` Steven Degutis
2013-04-11 8:04 ` Bastien
2013-04-11 13:42 ` Jambunathan K
3 siblings, 2 replies; 18+ messages in thread
From: Le Wang @ 2013-04-11 7:35 UTC (permalink / raw)
To: Steven Degutis; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
I use highlight symbols to highlight same symbols, and jump between them.
It chooses rainbow colors automatically and makes it much easier to follow
some key variables through a block of code.
My fork https://github.com/lewang/highlight-symbol.el allows you to use
arbitrary region as a "symbol".
On Thu, Apr 11, 2013 at 10:24 AM, Steven Degutis <sbdegutis@gmail.com>wrote:
> 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?
>
> -Steven
>
--
Le
[-- Attachment #2: Type: text/html, Size: 1354 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
[not found] <mailman.23929.1365647063.855.help-gnu-emacs@gnu.org>
@ 2013-04-11 7:43 ` Chris F.A. Johnson
2013-04-11 7:57 ` Damien Wyart
2013-04-11 8:22 ` Chris F.A. Johnson
0 siblings, 2 replies; 18+ messages in thread
From: Chris F.A. Johnson @ 2013-04-11 7:43 UTC (permalink / raw)
To: help-gnu-emacs
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)))
--
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)
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
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
1 sibling, 0 replies; 18+ messages in thread
From: Damien Wyart @ 2013-04-11 7:57 UTC (permalink / raw)
To: help-gnu-emacs
> > 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?
* "Chris F.A. Johnson" <cfajohnson@gmail.com> in gnu.emacs.help:
> This is what I use:
> (defun current-word-search ()
> "search forward for word under cursor"
> (interactive)
> (word-search-forward (current-word)))
I was about to point OP to highlight-symbol.el, but your solution seems
simple and elegant.
A few links anyway:
http://emacswiki.org/emacs/SearchAtPoint
http://stackoverflow.com/questions/10373118/vim-like-next-previous-word-at-point-in-emacs
http://www.emacswiki.org/emacs/HighlightSymbol
http://nschum.de/src/emacs/highlight-symbol/
https://github.com/nschum/highlight-symbol.el
--
DW
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
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 8:04 ` Bastien
2013-04-11 14:13 ` Steven Degutis
2013-04-11 13:42 ` Jambunathan K
3 siblings, 1 reply; 18+ messages in thread
From: Bastien @ 2013-04-11 8:04 UTC (permalink / raw)
To: Steven Degutis; +Cc: help-gnu-emacs@gnu.org
Hi Steven,
Steven Degutis <sbdegutis@gmail.com> writes:
> Is there a better way to do this?
I use this:
(defun next-word-at-point (previous)
"Jump to the next occurrence of the word at point."
(interactive "P")
(let* ((w (thing-at-point 'word))
(w (mapconcat
(lambda(c) (if (eq (char-syntax c) ?w)
(char-to-string c))) w ""))
(wre (concat "\\<" w "\\>"))
(s (if previous #'re-search-backward #'re-search-forward)))
(unless previous (forward-word 1))
(funcall s wre nil t)
(unless previous (re-search-backward wre nil t))))
(defun previous-word-at-point ()
"Jump to the previous occurrence of the word at point."
(interactive)
(next-word-at-point t))
(define-key global-map "\M-n" 'next-word-at-point)
(define-key global-map "\M-p" 'previous-word-at-point)
--
Bastien
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
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
2013-04-11 14:05 ` Steven Degutis
1 sibling, 1 reply; 18+ messages in thread
From: Chris F.A. Johnson @ 2013-04-11 8:22 UTC (permalink / raw)
To: help-gnu-emacs
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)
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
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
1 sibling, 1 reply; 18+ messages in thread
From: Jambunathan K @ 2013-04-11 13:39 UTC (permalink / raw)
To: Le Wang; +Cc: Steven Degutis, help-gnu-emacs@gnu.org
Le Wang <l26wang@gmail.com> writes:
> I use highlight symbols to highlight same symbols, and jump between
> them. It chooses rainbow colors automatically and makes it much easier
> to follow some key variables through a block of code.
>
> My fork https://github.com/lewang/highlight-symbol.el allows you to
> use arbitrary region as a "symbol".
If you are using Emacs from Bzr, then `highlight-symbol' is no longer
needed.
C-h v hi-lock-auto-select-face
C-h v hi-lock-read-regexp-defaults-function
You may want to file a bug report if some feature is missing.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-11 2:24 Steven Degutis
` (2 preceding siblings ...)
2013-04-11 8:04 ` Bastien
@ 2013-04-11 13:42 ` Jambunathan K
2013-04-11 14:08 ` Steven Degutis
3 siblings, 1 reply; 18+ messages in thread
From: Jambunathan K @ 2013-04-11 13:42 UTC (permalink / raw)
To: Steven Degutis; +Cc: help-gnu-emacs@gnu.org
Steven Degutis <sbdegutis@gmail.com> writes:
> 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.
If you are using Emacs from bzr, configure the variable below to run
occur for symbol at point.
C-h v occur-read-regexp-defaults-function
Then jump around with
M-s o
M-g M-n
M-g M-n
M-g M-p
or look at occur before and jump directly to the needed location.
>
> Is there a better way to do this?
>
> -Steven
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-11 8:22 ` Chris F.A. Johnson
@ 2013-04-11 14:05 ` Steven Degutis
[not found] ` <878v4omosz.fsf@casenave-pere.fr>
0 siblings, 1 reply; 18+ messages in thread
From: Steven Degutis @ 2013-04-11 14:05 UTC (permalink / raw)
To: cfajohnson; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1674 bytes --]
This was the simplest and most elegant. But I didn't realize until after I
tried it that I heavily rely on the highlighting that isearch-mode uses.
-Steven
On Thu, Apr 11, 2013 at 3:22 AM, Chris F.A. Johnson <cfajohnson@gmail.com>wrote:
> 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)
>
[-- Attachment #2: Type: text/html, Size: 2379 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-11 7:35 ` Le Wang
2013-04-11 13:39 ` Jambunathan K
@ 2013-04-11 14:06 ` Steven Degutis
1 sibling, 0 replies; 18+ messages in thread
From: Steven Degutis @ 2013-04-11 14:06 UTC (permalink / raw)
To: Le Wang; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]
This is my favorite solution so far. The only problem with it is that it
doesn't play nicely with hl-line-mode, so when my current line has a
special background, highlight-symbol's background is overridden. This
wasn't the case with isearch-mode. Do you think this would be hard to fix?
-Steven
On Thu, Apr 11, 2013 at 2:35 AM, Le Wang <l26wang@gmail.com> wrote:
> I use highlight symbols to highlight same symbols, and jump between them.
> It chooses rainbow colors automatically and makes it much easier to follow
> some key variables through a block of code.
>
> My fork https://github.com/lewang/highlight-symbol.el allows you to use
> arbitrary region as a "symbol".
>
>
> On Thu, Apr 11, 2013 at 10:24 AM, Steven Degutis <sbdegutis@gmail.com>wrote:
>
>> 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?
>>
>> -Steven
>>
>
>
>
> --
> Le
>
[-- Attachment #2: Type: text/html, Size: 2155 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-11 13:42 ` Jambunathan K
@ 2013-04-11 14:08 ` Steven Degutis
2013-04-11 17:06 ` Jambunathan K
0 siblings, 1 reply; 18+ messages in thread
From: Steven Degutis @ 2013-04-11 14:08 UTC (permalink / raw)
To: Jambunathan K; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]
First of all those keys are stolen by paredit.
Second of all the UI for this seems like overkill compared to
highlight-symbol.el. It doesn't need its own window, it just should
highlight matches in the current window and allow me to jump between them
easily. But knowing emacs, there's probably some variable to disable
opening a new window with the search results.
And finally, it doesn't seem to highlight the matches in the buffer.
-Steven
On Thu, Apr 11, 2013 at 8:42 AM, Jambunathan K <kjambunathan@gmail.com>wrote:
> Steven Degutis <sbdegutis@gmail.com> writes:
>
> > 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.
>
> If you are using Emacs from bzr, configure the variable below to run
> occur for symbol at point.
>
> C-h v occur-read-regexp-defaults-function
>
>
> Then jump around with
>
> M-s o
> M-g M-n
> M-g M-n
> M-g M-p
>
> or look at occur before and jump directly to the needed location.
>
> >
> > Is there a better way to do this?
> >
> > -Steven
>
[-- Attachment #2: Type: text/html, Size: 1946 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-11 13:39 ` Jambunathan K
@ 2013-04-11 14:09 ` Steven Degutis
0 siblings, 0 replies; 18+ messages in thread
From: Steven Degutis @ 2013-04-11 14:09 UTC (permalink / raw)
To: Jambunathan K; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 873 bytes --]
I am using trunk, but these variables don't exist.
ELISP> (emacs-version)
"GNU Emacs 24.3.50.1 (i386-apple-darwin12.3.0, NS apple-appkit-1187.37)\n
of 2013-04-10 on Stevens-Mac-Pro.local"
-Steven
On Thu, Apr 11, 2013 at 8:39 AM, Jambunathan K <kjambunathan@gmail.com>wrote:
> Le Wang <l26wang@gmail.com> writes:
>
> > I use highlight symbols to highlight same symbols, and jump between
> > them. It chooses rainbow colors automatically and makes it much easier
> > to follow some key variables through a block of code.
> >
> > My fork https://github.com/lewang/highlight-symbol.el allows you to
> > use arbitrary region as a "symbol".
>
> If you are using Emacs from Bzr, then `highlight-symbol' is no longer
> needed.
>
> C-h v hi-lock-auto-select-face
> C-h v hi-lock-read-regexp-defaults-function
>
> You may want to file a bug report if some feature is missing.
>
[-- Attachment #2: Type: text/html, Size: 1499 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-11 8:04 ` Bastien
@ 2013-04-11 14:13 ` Steven Degutis
2013-04-13 0:19 ` Bastien
0 siblings, 1 reply; 18+ messages in thread
From: Steven Degutis @ 2013-04-11 14:13 UTC (permalink / raw)
To: Bastien; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]
Are these functions defining word boundaries? What are the \\< and \\> used
for? Using (current-word) should probably be sufficient, no?
Also, I didn't realize this until after I tried Chris's solution, but I
also need it to highlight other occurrences of (current-word) in the buffer.
-Steven
On Thu, Apr 11, 2013 at 3:04 AM, Bastien <bzg@altern.org> wrote:
> Hi Steven,
>
> Steven Degutis <sbdegutis@gmail.com> writes:
>
> > Is there a better way to do this?
>
> I use this:
>
> (defun next-word-at-point (previous)
> "Jump to the next occurrence of the word at point."
> (interactive "P")
> (let* ((w (thing-at-point 'word))
> (w (mapconcat
> (lambda(c) (if (eq (char-syntax c) ?w)
> (char-to-string c))) w ""))
> (wre (concat "\\<" w "\\>"))
> (s (if previous #'re-search-backward #'re-search-forward)))
> (unless previous (forward-word 1))
> (funcall s wre nil t)
> (unless previous (re-search-backward wre nil t))))
>
> (defun previous-word-at-point ()
> "Jump to the previous occurrence of the word at point."
> (interactive)
> (next-word-at-point t))
>
> (define-key global-map "\M-n" 'next-word-at-point)
> (define-key global-map "\M-p" 'previous-word-at-point)
>
> --
> Bastien
>
[-- Attachment #2: Type: text/html, Size: 1983 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-11 14:08 ` Steven Degutis
@ 2013-04-11 17:06 ` Jambunathan K
0 siblings, 0 replies; 18+ messages in thread
From: Jambunathan K @ 2013-04-11 17:06 UTC (permalink / raw)
To: Steven Degutis; +Cc: help-gnu-emacs@gnu.org
If you don't find
`hi-lock-read-regexp-defaults-function'
`occur-read-regexp-defaults-function'
`find-tag-default-as-regexp'
then your bzr version in not the most recent one. Try upgrading. Here
is some customization that I have in .emacs.
--8<---------------cut here---------------start------------->8---
(setq hi-lock-read-regexp-defaults-function 'find-tag-default-as-regexp)
(setq occur-read-regexp-defaults-function 'find-tag-default-as-regexp)
(add-hook 'occur-hook (lambda nil (next-error)
(delete-other-windows)))
(add-hook 'occur-mode-find-occurrence-hook
(lambda nil (highlight-regexp (find-tag-default-as-regexp))))
--8<---------------cut here---------------end--------------->8---
Steven Degutis <sbdegutis@gmail.com> writes:
> First of all those keys are stolen by paredit.
>
> Second of all the UI for this seems like overkill compared to
> highlight-symbol.el. It doesn't need its own window, it just should
> highlight matches in the current window and allow me to jump between
> them easily. But knowing emacs, there's probably some variable to
> disable opening a new window with the search results.
>
> And finally, it doesn't seem to highlight the matches in the buffer.
>
> -Steven
>
> On Thu, Apr 11, 2013 at 8:42 AM, Jambunathan K
> <kjambunathan@gmail.com> wrote:
>
> Steven Degutis <sbdegutis@gmail.com> writes:
>
> > 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.
>
>
> If you are using Emacs from bzr, configure the variable below to
> run
> occur for symbol at point.
>
> C-h v occur-read-regexp-defaults-function
>
>
> Then jump around with
>
> M-s o
> M-g M-n
> M-g M-n
> M-g M-p
>
> or look at occur before and jump directly to the needed location.
>
>
>
> >
> > Is there a better way to do this?
> >
> > -Steven
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
[not found] ` <878v4omosz.fsf@casenave-pere.fr>
@ 2013-04-12 5:50 ` Renaud Casenave-Péré
0 siblings, 0 replies; 18+ messages in thread
From: Renaud Casenave-Péré @ 2013-04-12 5:50 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
On Fri, Apr 12 2013, Renaud Casenave-Péré wrote:
> You may find this solution a bit overkill, but if you install evil, you can use
> something like this :
>
> (global-set-key (kbd "C-*") #'(lambda ()
> (interactive)
> (evil-search-symbol t))) ;; search forward
>
> (global-set-key (kbd "C-#") #'(lambda ()
> (interactive)
> (evil-search-symbol nil))) ;; search backward
>
> which does what you want and should work even if you don't use evil at all as
> long as you do (require 'evil-search).
Another (beggining of a) solution. With something like this :
(defun isearch-yank-word-at-point ()
"Pull the word at point into search string."
(interactive)
(goto-char (beginning-of-thing 'word))
(isearch-yank-internal
#'(lambda ()
(end-of-thing 'word))))
(define-key isearch-mode-map (kbd "C-*") 'isearch-yank-word-at-point)
In combination with `isearch-forward-word', you can jump to the next iteration
of the word you are on, using only isearch and thing-at-point facilities.
--
Renaud Casenave-Pere
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-11 14:13 ` Steven Degutis
@ 2013-04-13 0:19 ` Bastien
2013-04-13 0:22 ` Steven Degutis
0 siblings, 1 reply; 18+ messages in thread
From: Bastien @ 2013-04-13 0:19 UTC (permalink / raw)
To: Steven Degutis; +Cc: help-gnu-emacs@gnu.org
Hi Steven,
Steven Degutis <sbdegutis@gmail.com> writes:
> Are these functions defining word boundaries? What are the \\< and \
> \> used for? Using (current-word) should probably be sufficient, no?
(current-word t t) would better suits my own needs actually.
> Also, I didn't realize this until after I tried Chris's solution, but
> I also need it to highlight other occurrences of (current-word) in
> the buffer.
In that case, I think your first recipe (C-s C-w C-s) is the shortest
solution.
HTH,
--
Bastien
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Is there an easier way to jump to the same word?
2013-04-13 0:19 ` Bastien
@ 2013-04-13 0:22 ` Steven Degutis
0 siblings, 0 replies; 18+ messages in thread
From: Steven Degutis @ 2013-04-13 0:22 UTC (permalink / raw)
To: Bastien; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
Actually it looks like highlight-symbol.el is nearly perfect. The only
problem with it is that it doesn't render background colors properly on
matches when hl-line-mode is also used.
-Steven
On Fri, Apr 12, 2013 at 7:19 PM, Bastien <bzg@altern.org> wrote:
> Hi Steven,
>
> Steven Degutis <sbdegutis@gmail.com> writes:
>
> > Are these functions defining word boundaries? What are the \\< and \
> > \> used for? Using (current-word) should probably be sufficient, no?
>
> (current-word t t) would better suits my own needs actually.
>
> > Also, I didn't realize this until after I tried Chris's solution, but
> > I also need it to highlight other occurrences of (current-word) in
> > the buffer.
>
> In that case, I think your first recipe (C-s C-w C-s) is the shortest
> solution.
>
> HTH,
>
> --
> Bastien
>
[-- Attachment #2: Type: text/html, Size: 1407 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2013-04-13 0:22 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
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
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.