unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Andreas Politz <politza@fh-trier.de>
To: help-gnu-emacs@gnu.org
Subject: Re: How to search current word under cursor?
Date: Sat, 19 Jul 2008 21:27:23 +0200	[thread overview]
Message-ID: <1216495685.531766@arno.fh-trier.de> (raw)
In-Reply-To: <mailman.15011.1216429238.18990.help-gnu-emacs@gnu.org>

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



  parent reply	other threads:[~2008-07-19 19:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-17 12:01 How to search current word under cursor? Jijun MA
2006-05-17 12:09 ` Bastien
2008-07-18 13:13   ` cfelton
2008-07-19 16:24     ` Drew Adams
     [not found]   ` <mailman.15011.1216429238.18990.help-gnu-emacs@gnu.org>
2008-07-19 19:27     ` Andreas Politz [this message]
2006-05-17 13:43 ` Peter Dyballa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1216495685.531766@arno.fh-trier.de \
    --to=politza@fh-trier.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).