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

How to search current word under cursor?

661 views
Skip to first unread message

Jijun MA

unread,
May 17, 2006, 8:01:31 AM5/17/06
to

I want search this buffer of current word under cursor, how can I do it?
thank you

--

fireflower

Bastien

unread,
May 17, 2006, 8:09:07 AM5/17/06
to
Jijun MA <jjm...@gmail.com> writes:

> I want search this buffer of current word under cursor, how can I do
> it?

C-s C-w

--
Bastien

Peter Dyballa

unread,
May 17, 2006, 9:43:37 AM5/17/06
to Jijun MA, help-gn...@gnu.org

Am 17.05.2006 um 14:01 schrieb Jijun MA:

> I want search this buffer of current word under cursor, how can I
> do it?

M-b C-s C-w C-s

--
Greetings

Pete

"Let's face it; we don't want a free market economy either."
James Farley, president, Coca-Cola Export Corp., 1959


cfelton

unread,
Jul 18, 2008, 9:13:39 AM7/18/08
to Help-gn...@gnu.org

How do you extend this to the occur function? I have a key binding mapped to
the occur function, and I would like the word at the cursor (compete word
foo_bar, not just foo) to be the default search when invoked?

Thanks

> _______________________________________________
> help-gnu-emacs mailing list
> help-gn...@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>
>

--
View this message in context: http://www.nabble.com/How-to-search-current-word-under-cursor--tp4429652p18528933.html
Sent from the Emacs - Help mailing list archive at Nabble.com.

Drew Adams

unread,
Jul 19, 2008, 12:24:48 PM7/19/08
to cfelton, Help-gn...@gnu.org
> >> I want search this buffer of current word under cursor,
> >> how can I do it?
> >
> > C-s C-w
>
> How do you extend this to the occur function? I have a key
> binding mapped to the occur function, and I would like the
> word at the cursor (compete word foo_bar, not just foo) to be
> the default search when invoked?

http://www.emacswiki.org/cgi-bin/wiki/OccurFromIsearch

(Also, C-s C-w C-w... accumulates search text, so C-s C-w C-w will pick up
foo_bar as the search string.)

Andreas Politz

unread,
Jul 19, 2008, 3:27:23 PM7/19/08
to
cfelton wrote:
> How do you extend this to the occur function? I have a key binding mapped to
> the occur function, and I would like the word at the cursor (compete word
> foo_bar, not just foo) to be the default search when invoked?
>
> Thanks
>
>
> bastien-3 wrote:
>> Jijun MA <jjm...@gmail.com> writes:
>>
>>> I want search this buffer of current word under cursor, how can I do
>>> it?
>> C-s C-w
>>
>> --
>> Bastien

occur takes the first item in `regexp-history' as default value.
This list can be manipulated.

(defun occur-symbol-at-point ()
(interactive)
(let ((sym (thing-at-point 'symbol)))
(if sym
(push (regexp-quote sym) regexp-history)) ;regexp-history defvared in replace.el
(call-interactively 'occur)))


-ap

0 new messages