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

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

Re: keyboard regexp shortcuts


From: Jambunathan K
Subject: Re: keyboard regexp shortcuts
Date: Sat, 18 Aug 2012 00:24:37 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Scott Frazer <frazer.scott@gmail.com> writes:

> On 8/17/12 10:20 AM, Perry Smith wrote:
>> Very often, I do a regex search (M-C-s) of \_<foo\_> because I don't
>> want to find bad_foo_dog.
>>
>> Typing the \ _ < and \ _ > is tedious.  Can someone suggest a way to
>> make that easier?
>>
>> Thank you,
>> Perry
>>
>
> Here's what I use:
>
> (defun my-isearch-word ()
>   "Surround current input with word/symbol delimiters and turn on regexp 
> matching if necessary."
>   (interactive)
>   (unless isearch-regexp
>     (isearch-toggle-regexp))
>   (setq isearch-string (concat "\\_<" isearch-string "\\_>")
>         isearch-message (mapconcat 'isearch-text-char-description 
> isearch-string ""))
>   (isearch-search-and-update))
>
> (define-key isearch-mode-map (kbd "M-w") 'my-isearch-word)

In development version of Emacs, there is a better way.

,---- NEWS
| * Editing Changes in Emacs 24.3
| 
| ** Search changes
| 
| *** Global `M-s _' starts a symbol (identifier) incremental search,
| and `M-s _' in Isearch toggles symbol search mode.
| `M-s c' in Isearch toggles search case-sensitivity.
`----



>
>
>
>

-- 



reply via email to

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