all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* keyboard regexp shortcuts
@ 2012-08-17 14:20 Perry Smith
  2012-08-17 18:04 ` Scott Frazer
  0 siblings, 1 reply; 3+ messages in thread
From: Perry Smith @ 2012-08-17 14:20 UTC (permalink / raw)
  To: Emacs help

[-- Attachment #1: Type: text/plain, Size: 209 bytes --]

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


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: keyboard regexp shortcuts
  2012-08-17 14:20 keyboard regexp shortcuts Perry Smith
@ 2012-08-17 18:04 ` Scott Frazer
  2012-08-17 18:54   ` Jambunathan K
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Frazer @ 2012-08-17 18:04 UTC (permalink / raw)
  To: help-gnu-emacs

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)





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: keyboard regexp shortcuts
  2012-08-17 18:04 ` Scott Frazer
@ 2012-08-17 18:54   ` Jambunathan K
  0 siblings, 0 replies; 3+ messages in thread
From: Jambunathan K @ 2012-08-17 18:54 UTC (permalink / raw)
  To: Scott Frazer; +Cc: help-gnu-emacs

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



>
>
>
>

-- 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-17 18:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-17 14:20 keyboard regexp shortcuts Perry Smith
2012-08-17 18:04 ` Scott Frazer
2012-08-17 18:54   ` Jambunathan K

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.