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

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

Re: search forward at point question


From: Barry Margolin
Subject: Re: search forward at point question
Date: Thu, 05 Mar 2009 21:01:20 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.2410.1236235328.31690.help-gnu-emacs@gnu.org>,
 Maindoor <sanjeevfiles@yahoo.com> wrote:

> Hi,
>      I have the following code to search forward from point.
>      But If I have a string like SOMETHING_HERE=$(HI)
> 
>      then this code yanks the whole "SOMETHING_HERE=$"
>      and searches for it forward. How do I limit it to
>      "SOMETHING_HERE". I want it to stop if it encounters
>      any special characters except "_" and "-". 

C-h f current-word

and see the really-word parameter.  However, you may also need to change 
the syntax table to make "_" and "-" be considered word constituents.

> 
>      Here is the code:
> 
> (defun my-viper-search-yank-word (arg forward)
>   "Search forward for ARG occurance of word under point.
> If FORWARD is nil, searches backward instead."
>   (let ((viper-re-search t))
>     (viper-search
>      (concat "\\<" (regexp-quote (current-word)) "\\>") forward arg)))
> 
> (defun my-viper-search-forward-yank-word (arg)
>   "Search forward for ARG occurance of word under point.
> Like the Vim command \"*\" (but not exactly)."
>   (interactive "P")
>   (my-viper-search-yank-word arg t))
> 
> Regards,
> Maindoor.
> 




-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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