help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to search current word under cursor?


From: Andreas Politz
Subject: Re: How to search current word under cursor?
Date: Sat, 19 Jul 2008 21:27:23 +0200
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)

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 <jjmmma@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]