all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to mark and search text in less keystrokes ?
@ 2008-10-02 13:12 Christiano Farina Haesbaert
  2008-10-02 14:07 ` Mathias Dahl
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Christiano Farina Haesbaert @ 2008-10-02 13:12 UTC (permalink / raw)
  To: help-gnu-emacs

I saw my boss doing the following in vi the other day and it seemed
quite useful, suppose:

You are editing a buffer, and your pointer is at the word
myfunc(a,b),

How can I search for the occurences of the word myfunc at the same
buffer AND mark my position where I was, so I can iterate through the
results and get back to my original spot at any time.

For now I'm using C^s and "typing" the word ( I know it's lame ), and
when I want to get back I loop thought until I'm back at the original
spot.

Please if I didn't make myself clear I can try to explain better.

Another thing, is it possible to iterate through all function calls of
myfunc in a directory ?
Currently I gave a grep, that tries to match the patter of myfunc
call, but is kinda clumsy.

obs: As you can see I'm not an Emacs wizard, it's just my second
month.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: How to mark and search text in less keystrokes ?
  2008-10-02 13:12 How to mark and search text in less keystrokes ? Christiano Farina Haesbaert
@ 2008-10-02 14:07 ` Mathias Dahl
  2008-10-02 14:28 ` Lennart Borgman (gmail)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Mathias Dahl @ 2008-10-02 14:07 UTC (permalink / raw)
  To: help-gnu-emacs

Christiano Farina Haesbaert <christiano.fh@gmail.com> writes:

> How can I search for the occurences of the word myfunc at the same
> buffer AND mark my position where I was, so I can iterate through the
> results and get back to my original spot at any time.

Try C-s and then C-w to "pull" words into the search string.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: How to mark and search text in less keystrokes ?
  2008-10-02 13:12 How to mark and search text in less keystrokes ? Christiano Farina Haesbaert
  2008-10-02 14:07 ` Mathias Dahl
@ 2008-10-02 14:28 ` Lennart Borgman (gmail)
  2008-10-02 15:42   ` Drew Adams
       [not found]   ` <mailman.53.1222962172.25473.help-gnu-emacs@gnu.org>
  2008-10-02 14:29 ` Parker, Matthew
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Lennart Borgman (gmail) @ 2008-10-02 14:28 UTC (permalink / raw)
  To: Christiano Farina Haesbaert; +Cc: help-gnu-emacs

Christiano Farina Haesbaert wrote:
> I saw my boss doing the following in vi the other day and it seemed
> quite useful, suppose:
> 
> You are editing a buffer, and your pointer is at the word
> myfunc(a,b),
> 
> How can I search for the occurences of the word myfunc at the same
> buffer AND mark my position where I was, so I can iterate through the
> results and get back to my original spot at any time.
> 
> For now I'm using C^s and "typing" the word ( I know it's lame ), and
> when I want to get back I loop thought until I'm back at the original
> spot.

Start with

  C-s C-w

and then to move use

  C-s

To go back use C-g

> Please if I didn't make myself clear I can try to explain better.
> 
> Another thing, is it possible to iterate through all function calls of
> myfunc in a directory ?
> Currently I gave a grep, that tries to match the patter of myfunc
> call, but is kinda clumsy.

Have you tested lgrep and rgrep in Emacs?

> obs: As you can see I'm not an Emacs wizard, it's just my second
> month.
> 
> 




^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: How to mark and search text in less keystrokes ?
  2008-10-02 13:12 How to mark and search text in less keystrokes ? Christiano Farina Haesbaert
  2008-10-02 14:07 ` Mathias Dahl
  2008-10-02 14:28 ` Lennart Borgman (gmail)
@ 2008-10-02 14:29 ` Parker, Matthew
       [not found] ` <mailman.44.1222957709.25473.help-gnu-emacs@gnu.org>
  2008-10-02 15:37 ` Drew Adams
  4 siblings, 0 replies; 12+ messages in thread
From: Parker, Matthew @ 2008-10-02 14:29 UTC (permalink / raw)
  To: Christiano Farina Haesbaert, help-gnu-emacs

With point just before a word

C-s C-w does a search on that word

Repeated C-s will step through matches

C-g will quit search and return point to where you started

Return/Enter will stop search and leave point at current match



Matthew Parker

SEI  | 1 Freedom Valley Drive | Oaks, PA 19456 | p: 610-676-1279 | f:
484-676-1279 | www.seic.com
-----Original Message-----
From: help-gnu-emacs-bounces+mparker=seic.com@gnu.org
[mailto:help-gnu-emacs-bounces+mparker=seic.com@gnu.org] On Behalf Of
Christiano Farina Haesbaert
Sent: Thursday, October 02, 2008 9:13 AM
To: help-gnu-emacs@gnu.org
Subject: How to mark and search text in less keystrokes ?

I saw my boss doing the following in vi the other day and it seemed
quite useful, suppose:

You are editing a buffer, and your pointer is at the word
myfunc(a,b),

How can I search for the occurences of the word myfunc at the same
buffer AND mark my position where I was, so I can iterate through the
results and get back to my original spot at any time.

For now I'm using C^s and "typing" the word ( I know it's lame ), and
when I want to get back I loop thought until I'm back at the original
spot.

Please if I didn't make myself clear I can try to explain better.

Another thing, is it possible to iterate through all function calls of
myfunc in a directory ?
Currently I gave a grep, that tries to match the patter of myfunc
call, but is kinda clumsy.

obs: As you can see I'm not an Emacs wizard, it's just my second
month.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: How to mark and search text in less keystrokes ?
       [not found] ` <mailman.44.1222957709.25473.help-gnu-emacs@gnu.org>
@ 2008-10-02 14:57   ` Christiano Farina Haesbaert
  2008-10-02 15:41     ` Andreas Politz
  0 siblings, 1 reply; 12+ messages in thread
From: Christiano Farina Haesbaert @ 2008-10-02 14:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 2, 11:28 am, "Lennart Borgman (gmail)"
<lennart.borg...@gmail.com> wrote:
> Start with
>
>   C-s C-w
>
> and then to move use
>
>   C-s
>
> To go back use C-g

Thanks a lot Lennart and Mathias, that was exactly what I wanted.

> Have you tested lgrep and rgrep in Emacs?
>
Not yet, I was using normal grep in emacs, I will take a look into it.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: How to mark and search text in less keystrokes ?
  2008-10-02 13:12 How to mark and search text in less keystrokes ? Christiano Farina Haesbaert
                   ` (3 preceding siblings ...)
       [not found] ` <mailman.44.1222957709.25473.help-gnu-emacs@gnu.org>
@ 2008-10-02 15:37 ` Drew Adams
  4 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2008-10-02 15:37 UTC (permalink / raw)
  To: 'Christiano Farina Haesbaert', help-gnu-emacs

> How can I search for the occurences of the word myfunc at the same
> buffer AND mark my position where I was, so I can iterate through the
> results and get back to my original spot at any time.

After searching, use `C-x C-x' to get back to where the searching started. This
works because Isearch sets the mark before searching.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: How to mark and search text in less keystrokes ?
  2008-10-02 14:57   ` Christiano Farina Haesbaert
@ 2008-10-02 15:41     ` Andreas Politz
  0 siblings, 0 replies; 12+ messages in thread
From: Andreas Politz @ 2008-10-02 15:41 UTC (permalink / raw)
  To: help-gnu-emacs

Christiano Farina Haesbaert wrote:
> On Oct 2, 11:28 am, "Lennart Borgman (gmail)"
> <lennart.borg...@gmail.com> wrote:
>> Start with
>>
>>   C-s C-w
>>
>> and then to move use
>>
>>   C-s
>>
>> To go back use C-g
> 
> Thanks a lot Lennart and Mathias, that was exactly what I wanted.
> 

Here is some more on isearch :

http://sachachua.com/wp/2008/07/27/emacs-keyboard-shortcuts-for-navigating-code/

-ap


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: How to mark and search text in less keystrokes ?
  2008-10-02 14:28 ` Lennart Borgman (gmail)
@ 2008-10-02 15:42   ` Drew Adams
  2008-10-02 21:32     ` Nikolaj Schumacher
       [not found]   ` <mailman.53.1222962172.25473.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Drew Adams @ 2008-10-02 15:42 UTC (permalink / raw)
  To: 'Lennart Borgman (gmail)',
	'Christiano Farina Haesbaert'
  Cc: help-gnu-emacs

> > How can I search for the occurences of the word myfunc at the same
> > buffer AND mark my position where I was, so I can iterate 
> > through the results and get back to my original spot at any time.

One reply:

> To go back use C-g

Another reply, saying the same thing:

> C-g will quit search and return point to where you started

But C-g takes you back to the beginning only if you never exited Isearch (e.g.
with RET).

I thought the OP meant that he exited search and later wanted to get back to the
search start. For that, just use `C-x C-x'.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: How to mark and search text in less keystrokes ?
       [not found]   ` <mailman.53.1222962172.25473.help-gnu-emacs@gnu.org>
@ 2008-10-02 17:31     ` Christiano Farina Haesbaert
  2008-10-02 18:04       ` Christiano Farina Haesbaert
  0 siblings, 1 reply; 12+ messages in thread
From: Christiano Farina Haesbaert @ 2008-10-02 17:31 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 2, 12:42 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > How can I search for the occurences of the word myfunc at the same
> > > buffer AND mark my position where I was, so I can iterate
> > > through the results and get back to my original spot at any time.
>
> One reply:
>
> > To go back use C-g
>
> Another reply, saying the same thing:
>
> > C-g will quit search and return point to where you started
>
> But C-g takes you back to the beginning only if you never exited Isearch (e.g.
> with RET).
>
> I thought the OP meant that he exited search and later wanted to get back to the
> search start. For that, just use `C-x C-x'.

Actually you are right, that's what I meant, I figured that C-g would
only work after my reply, C-x C-x is what I need indeed.

Thanks a lot.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: How to mark and search text in less keystrokes ?
  2008-10-02 17:31     ` Christiano Farina Haesbaert
@ 2008-10-02 18:04       ` Christiano Farina Haesbaert
  0 siblings, 0 replies; 12+ messages in thread
From: Christiano Farina Haesbaert @ 2008-10-02 18:04 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 2, 2:31 pm, Christiano Farina Haesbaert
<christiano...@gmail.com> wrote:

> Actually you are right, that's what I meant, I figured that C-g would
> only work after my reply, C-x C-x is what I need indeed.
>
> Thanks a lot.

Argh I mean, C-g would not work as I wanted.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: How to mark and search text in less keystrokes ?
  2008-10-02 15:42   ` Drew Adams
@ 2008-10-02 21:32     ` Nikolaj Schumacher
  2008-10-02 21:46       ` Drew Adams
  0 siblings, 1 reply; 12+ messages in thread
From: Nikolaj Schumacher @ 2008-10-02 21:32 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Christiano Farina Haesbaert', help-gnu-emacs

"Drew Adams" <drew.adams@oracle.com> wrote:

> I thought the OP meant that he exited search and later wanted to get
> back to the search start. For that, just use `C-x C-x'.

But that will activate the mark in transient-mark-mode.
C-u C-SPC will just jump to the previous mark (and pop it off the mark ring).

regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: How to mark and search text in less keystrokes ?
  2008-10-02 21:32     ` Nikolaj Schumacher
@ 2008-10-02 21:46       ` Drew Adams
  0 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2008-10-02 21:46 UTC (permalink / raw)
  To: 'Nikolaj Schumacher'
  Cc: 'Christiano Farina Haesbaert', help-gnu-emacs

> > I thought the OP meant that he exited search and later wanted to get
> > back to the search start. For that, just use `C-x C-x'.
> 
> But that will activate the mark in transient-mark-mode.

And?

I use `transient-mark-mode' (via `delete-selection-mode), and I still typically
use `C-x C-x', not `C-u C-SPC', in this context. `C-g' deactivates the mark, if
you don't want it to remain active - so `C-x C-x C-g'.

> C-u C-SPC will just jump to the previous mark (and pop it off 
> the mark ring).

But `C-x C-x' lets you go back and forth between the search hit and the origin.
To get back to the search hit after you've done `C-u C-SPC', you must cycle all
the way around the `mark-ring' (or use a numeric arg).

Anyway, glad you mentioned `C-u C-SPC' here. It's good to be aware of multiple
possibilities and what each does. The important thing here is that `C-s' sets
the mark before it sets off on its quest for search hits.






^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-10-02 21:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-02 13:12 How to mark and search text in less keystrokes ? Christiano Farina Haesbaert
2008-10-02 14:07 ` Mathias Dahl
2008-10-02 14:28 ` Lennart Borgman (gmail)
2008-10-02 15:42   ` Drew Adams
2008-10-02 21:32     ` Nikolaj Schumacher
2008-10-02 21:46       ` Drew Adams
     [not found]   ` <mailman.53.1222962172.25473.help-gnu-emacs@gnu.org>
2008-10-02 17:31     ` Christiano Farina Haesbaert
2008-10-02 18:04       ` Christiano Farina Haesbaert
2008-10-02 14:29 ` Parker, Matthew
     [not found] ` <mailman.44.1222957709.25473.help-gnu-emacs@gnu.org>
2008-10-02 14:57   ` Christiano Farina Haesbaert
2008-10-02 15:41     ` Andreas Politz
2008-10-02 15:37 ` Drew Adams

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.