* repeating a search a certain number of times
2016-01-18 17:05 ` Barry Margolin
@ 2016-01-21 17:36 ` Timur Aydin
2016-01-21 18:10 ` Drew Adams
0 siblings, 1 reply; 4+ messages in thread
From: Timur Aydin @ 2016-01-21 17:36 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
I have been looking for a way to repeat a search a certain number of
times, and from the documentation i have found the search-forward
function to do that:
(search-forward "something" nil nil 5)
But unfortunately this isn't bound to a key. The docstring says it is
bound to <find>, but I don't know what that means. It isn't a lisp
function. I thought maybe it is a menu item, but can't see that in the
menu either.
So my question is, how can I bind this to a key so that when I press it,
it asks me for the string, then the repetition count and then goes ahead
and finds it?
--
Timur
^ permalink raw reply [flat|nested] 4+ messages in thread
* repeating a search a certain number of times
@ 2016-01-21 17:41 Timur Aydin
2016-01-21 22:14 ` Marcin Borkowski
0 siblings, 1 reply; 4+ messages in thread
From: Timur Aydin @ 2016-01-21 17:41 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
I have been looking for a way to repeat a search a certain number of
times, and from the documentation i have found the search-forward
function to do that:
(search-forward "something" nil nil 5)
But unfortunately this isn't bound to a key. The docstring says it is
bound to <find>, but I don't know what that means. It isn't a lisp
function. I thought maybe it is a menu item, but can't see that in the
menu either.
So my question is, how can I bind this to a key so that when I press it,
it asks me for the string, then the repetition count and then goes ahead
and finds it?
--
Timur
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: repeating a search a certain number of times
2016-01-21 17:36 ` repeating a search a certain number of times Timur Aydin
@ 2016-01-21 18:10 ` Drew Adams
0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2016-01-21 18:10 UTC (permalink / raw)
To: Timur Aydin, help-gnu-emacs
> I have been looking for a way to repeat a search a certain number of
> times, and from the documentation i have found the search-forward
> function to do that:
>
> (search-forward "something" nil nil 5)
>
> But unfortunately this isn't bound to a key. The docstring says it is
> bound to <find>, but I don't know what that means. It isn't a lisp
> function. I thought maybe it is a menu item, but can't see that in the
> menu either.
>
> So my question is, how can I bind this to a key so that when I press it,
> it asks me for the string, then the repetition count and then goes ahead
> and finds it?
`search-forward' is bound to `C-s RET'. Just repeat `C-s RET' to repeat
your search (no need to enter the same input again).
See the Emacs manual, node `Nonincremental Search': `C-h r g noni TAB RET'.
Is there some reason you do not want to use incremental search: `C-s'?
If you do that, then just repeat `C-s'.
See the Emacs manual, node `Incremental Search': `C-h r g incr TAB RET'.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: repeating a search a certain number of times
2016-01-21 17:41 repeating a search a certain number of times Timur Aydin
@ 2016-01-21 22:14 ` Marcin Borkowski
0 siblings, 0 replies; 4+ messages in thread
From: Marcin Borkowski @ 2016-01-21 22:14 UTC (permalink / raw)
To: Timur Aydin; +Cc: help-gnu-emacs
On 2016-01-21, at 18:41, Timur Aydin <ta@taydin.org> wrote:
> Hello,
>
> I have been looking for a way to repeat a search a certain number of
> times, and from the documentation i have found the search-forward
> function to do that:
>
> (search-forward "something" nil nil 5)
>
> But unfortunately this isn't bound to a key. The docstring says it is
> bound to <find>, but I don't know what that means. It isn't a lisp
> function. I thought maybe it is a menu item, but can't see that in the
> menu either.
>
> So my question is, how can I bind this to a key so that when I press it,
> it asks me for the string, then the repetition count and then goes ahead
> and finds it?
Others will probably chime in, and I don't have the time to write that
function for you, but you might want to read these sections in the Elisp
reference:
(info "(emacs)Rebinding")
(info "(elisp)Using interactive")
(If you're reading this message in Emacs, place the point after any of
the above expressions, and press C-x C-e.)
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-21 22:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21 17:41 repeating a search a certain number of times Timur Aydin
2016-01-21 22:14 ` Marcin Borkowski
-- strict thread matches above, loose matches on Subject: below --
2016-01-17 20:07 Mac: Don't quit Emacs when window is closed Luis Gerhorst
2016-01-17 22:40 ` Marcin Borkowski
[not found] ` <mailman.2484.1453090928.843.help-gnu-emacs@gnu.org>
2016-01-18 17:05 ` Barry Margolin
2016-01-21 17:36 ` repeating a search a certain number of times Timur Aydin
2016-01-21 18:10 ` Drew Adams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).