Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

one shortcut next occurrence search

16 views
Skip to first unread message

zismad

unread,
Dec 22, 2010, 3:20:46 AM12/22/10
to Help-gn...@gnu.org

Hi all ,

I would like to have a new binding so that if im having the cursur on a
word, one shortcut click (say f3) whould find the next occurrence of the
word in the text and so one.

what is the right bind for it ?
I tried [(control s)(control w)] but its wrong.

thanks !
Zvika
--
View this message in context: http://old.nabble.com/one-shortcut-next-occurrence-search-tp30512323p30512323.html
Sent from the Emacs - Help mailing list archive at Nabble.com.


zismad

unread,
Dec 22, 2010, 8:22:08 AM12/22/10
to Help-gn...@gnu.org

Drew Adams

unread,
Dec 22, 2010, 10:03:29 PM12/22/10
to zismad, Help-gn...@gnu.org
> I would like to have a new binding so that if im having the
> cursur on a word, one shortcut click (say f3) whould find
> the next occurrence of the word in the text and so one.

What's wrong with ordinary `C-s C-w C-s C-s ...'?


zismad

unread,
Dec 23, 2010, 2:22:48 AM12/23/10
to Help-gn...@gnu.org

I want the the marked word to be found next when I hit f3.
maybe you'll call me lazy but `C-s C-w' is too much for me ...

thanks
Zvika

--
View this message in context: http://old.nabble.com/one-shortcut-next-occurrence-search-tp30512323p30519989.html

Tassilo Horn

unread,
Dec 23, 2010, 3:29:48 AM12/23/10
to help-gn...@gnu.org
zismad <zis...@gmail.com> writes:

Hi!

> I want the the marked word to be found next when I hit f3. maybe
> you'll call me lazy but `C-s C-w' is too much for me ...

I use highlight-symbol.el for that (and many other things):

http://nschum.de/src/emacs/highlight-symbol/

That's my config:

(require 'highlight-symbol)
(global-set-key [f8] 'highlight-symbol-at-point)
(global-set-key [(control f8)] 'highlight-symbol-next)
(global-set-key [(meta f8)] 'highlight-symbol-prev)

So F8 highlights any occurrence of the current word (symbol), C-F8 moves
to the next occurrence, M-F8 to the previous occurrence.

Bye,
Tassilo


Eli Zaretskii

unread,
Dec 23, 2010, 4:17:26 AM12/23/10
to Help-gn...@gnu.org
> Date: Wed, 22 Dec 2010 23:22:48 -0800 (PST)
> From: zismad <zis...@gmail.com>

>
>
> I want the the marked word to be found next when I hit f3.

You never said anything about the word being "marked", in your
original message. You only talked about "having cursor on a word".
How does the "marked" part enters this picture?

Elena

unread,
Dec 23, 2010, 4:31:57 AM12/23/10
to
On Dec 22, 8:20 am, zismad <zis...@gmail.com> wrote:
> Hi all ,
>
> I would like to have a new binding so that if im having the cursur on a
> word, one shortcut click (say f3) whould find the next occurrence of the
> word in the text and so one.
>
> what is the right bind for it ?
> I tried [(control s)(control w)] but its wrong.
>
> thanks !
> Zvika
> --
> View this message in context:http://old.nabble.com/one-shortcut-next-occurrence-search-tp30512323p...

> Sent from the Emacs - Help mailing list archive at Nabble.com.

If you are using Viper + Vimpulse - as you should, if you care about
your hands - it is:

* => next occurrence;
# => previous occurrence.

zismad

unread,
Dec 23, 2010, 8:26:50 AM12/23/10
to Help-gn...@gnu.org

thanks a lot Tassilo this is almost exactly as i wanted it to be.

is there anyway where i could search next my makred word
example

if i mark ex1-ex2 from line 1 and I hit f3 i want to it to jump to line 3
and not line2 as it does now :

ex1-ex2 ex3
ex1
ex1-ex2

thanks again
Zvika

--
View this message in context: http://old.nabble.com/one-shortcut-next-occurrence-search-tp30512323p30520429.html

Vagn Johansen

unread,
Dec 23, 2010, 8:39:07 AM12/23/10
to
zismad <zis...@gmail.com> writes:

> I want the the marked word to be found next when I hit f3.
> maybe you'll call me lazy but `C-s C-w' is too much for me ...

http://emacswiki.org/cgi-bin/wiki/SearchAtPoint


My version can be found here

http://www.emacswiki.org/emacs/VagnJohansen

--
Vagn Johansen

Tassilo Horn

unread,
Dec 23, 2010, 8:50:55 AM12/23/10
to help-gn...@gnu.org
zismad <zis...@gmail.com> writes:

Hi Zvika,

> is there anyway where i could search next my makred word
> example
>
> if i mark ex1-ex2 from line 1 and I hit f3 i want to it to jump to line 3
> and not line2 as it does now :
>
> ex1-ex2 ex3
> ex1
> ex1-ex2

For me, doing M-x highlight-symbol-next when point is on the first
line's ex1-ex2 jumps to the ex1-ex2 in line 3, just as you want it to
behave.

BTW: I'd pretty much advise against binding that to F3 (or F4), because
these are bound to macre creation and call by default. Those are much
too useful features to override their bindings.

Bye,
Tassilo


Drew Adams

unread,
Dec 23, 2010, 12:12:28 PM12/23/10
to zismad, Help-gn...@gnu.org
> >> I would like to have a new binding so that if im having the
> >> cursur on a word, one shortcut click (say f3) whould find
> >> the next occurrence of the word in the text and so one.
> >
> > What's wrong with ordinary `C-s C-w C-s C-s ...'?
>
> I want the the marked word to be found next when I hit f3.
> maybe you'll call me lazy but `C-s C-w' is too much for me ...

The `C-w' is only to "mark" the word, i.e. to say which word(s) you want to
visit. Thereafter, all you need is `C-s' for "the marked word to be found
next". And you can of course use any other key you like (e.g. f3) instead of
`C-s'.

So wrt laziness: hitting `f3' to visit each occurrence is no more difficult than
hitting `f3' to visit each occurrence. ;-)

> ex1-ex2 ex3
> ex1
> ex1-ex2

For that example, if you want to visit only the `ex1-ex2' occurrences, then
start by `C-s C-w C-w'.

Another alternative, besides `C-s' and the one Tassilo mentioned, is `occur'.
You can also access `occur' from `isearch' (`C-s').

And there are `occur' variants (enhancements) that provide other behavior.
Thierry Volpiatto's `ioccur' is one. Icicles's `C-'' is another
(`icicle-occur'). All of these (including vanilla `occur') let you not only
cycle among occurrences but also visit specific occurrences directly.

http://www.emacswiki.org/emacs/Icicles_-_Search_Commands%2c_Overview#toc2
http://www.emacswiki.org/emacs/OccurMode


LanX

unread,
Dec 23, 2010, 5:06:58 PM12/23/10
to
> I would like to have a new binding so that if im having the cursur on a
> word, one shortcut click (say f3) whould find the next occurrence of the
> word in the text and so one.
>
> what is the right bind for it ?
> I tried [(control s)(control w)] but its wrong.

Maybe M-b C-s C-w in a macro?

But don't use f3 it's already bound to macro recording.

rusi

unread,
Dec 24, 2010, 4:44:18 AM12/24/10
to

Thats very nifty -- thanks. So now a meta-question Drew: How do I find
out about things like C-w?

Specifically: How do I poke around in the keymap associated with C-s?
IOW, normally to find out about a keybinding, say C-x o, I'd type C-h
c C-x o, but if I do C-h c C-w I get kill-region -- nothing to do with
the C-w 'inside' C-s.

Teemu Likonen

unread,
Dec 24, 2010, 5:18:24 AM12/24/10
to
* 2010-12-24 01:44 (-0800), rusi wrote:

> Specifically: How do I poke around in the keymap associated with C-s?
> IOW, normally to find out about a keybinding, say C-x o, I'd type C-h
> c C-x o, but if I do C-h c C-w I get kill-region -- nothing to do with
> the C-w 'inside' C-s.

You can use keys

C-h m
C-h k
C-h b

in isearch mode to get help. This particular feature is also documented
in Emacs reference manual section "19.1.5 Isearch Yanking".

(info "(emacs) Isearch Yank")

Elena

unread,
Dec 24, 2010, 5:36:33 AM12/24/10
to

"C-s C-w" is not a keybinding. "C-s" runs isearch-forward, which puts
you into Isearch mode (as you can see into modeline), and you can
learn about its keybindings with "C-h m".

Otherwise, you can try "<prefix key> C-h", that is "C-c C-h", "C-x C-
h" and so on.

Tassilo Horn

unread,
Dec 24, 2010, 5:51:37 AM12/24/10
to help-gn...@gnu.org
Elena <egar...@gmail.com> writes:

> "C-s C-w" is not a keybinding. "C-s" runs isearch-forward, which puts
> you into Isearch mode (as you can see into modeline), and you can
> learn about its keybindings with "C-h m".
>
> Otherwise, you can try "<prefix key> C-h", that is "C-c C-h", "C-x C-
> h" and so on.

Yes, especially C-h b is useful for finding out the bindings for the
preceeding prefix. For example,

C-s C-h b

tells you all bindings of isearch.

Bye,
Tassilo


Elena

unread,
Dec 24, 2010, 6:17:18 AM12/24/10
to
On Dec 24, 11:51 am, Tassilo Horn <tass...@member.fsf.org> wrote:

I didn't know about the "C-h b". What's the difference? Why I have
to type "C-c C-h", "C-x C-h", etc. but "C-s C-h" does not work whilst
"C-s C-h b" does?

Funnily enough, according to "C-h c", "C-c C-h" and "C-x C-h" are not
bound to anything, neither is "C-h" alone (it is a prefix key).

Thanks.

Elena

unread,
Dec 24, 2010, 6:27:05 AM12/24/10
to
On Dec 24, 12:17 pm, Elena <egarr...@gmail.com> wrote:
> Funnily enough, according to "C-h c", "C-c C-h" and "C-x C-h" are not
> bound to anything, neither is "C-h" alone (it is a prefix key).

Wrong. "C-h" is not a prefix key, it is bound to "help". However,
I've not been able to figure out this by using help's bindings: "C-h
c", "C-h C-h b", etc.


Richard Riley

unread,
Dec 24, 2010, 6:27:21 AM12/24/10
to
Tassilo Horn <tas...@member.fsf.org> writes:

> Elena <egar...@gmail.com> writes:
>
>> "C-s C-w" is not a keybinding. "C-s" runs isearch-forward, which puts
>> you into Isearch mode (as you can see into modeline), and you can
>> learn about its keybindings with "C-h m".
>>
>> Otherwise, you can try "<prefix key> C-h", that is "C-c C-h", "C-x C-
>> h" and so on.
>
> Yes, especially C-h b is useful for finding out the bindings for the
> preceeding prefix. For example,
>
> C-s C-h b
>

Heh. Learn something new every day ... Thanks!

Drew Adams

unread,
Dec 24, 2010, 11:39:07 AM12/24/10
to Tassilo Horn, help-gn...@gnu.org
> > Otherwise, you can try "<prefix key> C-h", that is "C-c
> > C-h", "C-x C-h" and so on.

>
> Yes, especially C-h b is useful for finding out the bindings for the
> preceeding prefix. For example, C-s C-h b tells you all bindings of
> isearch.

Actually, Isearch is the exception in this regard. As Elena indicated,
typically all you have to do is hit the prefix key and then `C-h', to see the
bindings on that key.

IIRC, Isearch (`C-s') used to be that way too (Many Moon Ago), but then for a
long time `C-h' didn't work at all for `C-s'. Then Someone(TM) thought it would
be better for `C-s C-h' to give more general help, not just the bindings. So
now you need to add `b' to get the bindings.

[In Isearch+, I bind `C-s C-h' to a version of the standard command
`isearch-mode-help' that (a) gives help about Isearch and (b) lists the Isearch
key bindings. The (a) part is what vanilla Isearch gives you with `C-s C-h m'.
The (b) part is what it gives you with `C-s C-h b'.]

---

I will make a plug here also for command `describe-keymap' in library
help-fns+.el. It is bound to `C-h M-k'. It gives you a human-readable view of
keymaps. The only thing it leaves out (purposely) are menu bindings.

`C-h M-k RET isearch-mode-map' shows you the same thing as `C-s C-h b'. But the
`C-h' trick does not work with all prefix keys. And there are many keymaps that
are not bound to prefix keys.

`C-h M-k' can be useful even for keymaps that you cannot get to easily, such as
the minibuffer keymaps. You can even use it with `global-map'. But you can use
it only for keymaps that are the value of a variable (you are prompted for the
variable name).


Drew Adams

unread,
Dec 24, 2010, 11:39:35 AM12/24/10
to Elena, help-gn...@gnu.org
> I didn't know about the "C-h b". What's the difference? Why I have
> to type "C-c C-h", "C-x C-h", etc. but "C-s C-h" does not work whilst
> "C-s C-h b" does?

Someone(TM)'s infinite wisdom. See my earlier message.

> Funnily enough, according to "C-h c", "C-c C-h" and "C-x C-h" are not
> bound to anything, neither is "C-h" alone (it is a prefix key).

Yes, things like `C-c' are sometimes handled specially to get the `C-h'
behavior. `C-h' does not show up on the keymap (which in the case of `C-c' is
`mode-specific-map'). Try `C-h M-k' and you will see.

Bob Proulx

unread,
Dec 25, 2010, 11:37:37 AM12/25/10
to help-gn...@gnu.org
rusi wrote:

> Drew Adams wrote:
> > What's wrong with ordinary `C-s C-w C-s C-s ...'?
>
> Thats very nifty -- thanks. So now a meta-question Drew: How do I find
> out about things like C-w?

Once you know a key you can find the documentation associated with the
function associated with that key very easily.

C-h K C-s

That will take you to section 19.1.1 "Basics of Incremental Search"
where you can browse the documentation isearch-forward bound to to
C-s by default. In 19.1.5 "Isearch Yanking" you will encounter C-w.

The hard part is knowing what key you want to read about. But once
you have the key then you can find the documentation quite easily.

Bob

0 new messages