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

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

search forward at point question


From: Maindoor
Subject: search forward at point question
Date: Wed, 4 Mar 2009 22:42:00 -0800 (PST)

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 "-".

     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.


reply via email to

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