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,
Here's what I use:
(defun my-isearch-word ()
"Surround current input with word/symbol delimiters and turn on regexp matching if necessary."
(setq isearch-string (concat "\\_<" isearch-string "\\_>")
isearch-message (mapconcat 'isearch-text-char-description isearch-string ""))
(define-key isearch-mode-map (kbd "M-w") 'my-isearch-word)