From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Scott Frazer Newsgroups: gmane.emacs.help Subject: Re: keyboard regexp shortcuts Date: Fri, 17 Aug 2012 14:04:25 -0400 Message-ID: References: <5C3FB161-5143-43E7-BF06-84B0D72468E0@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345226688 16452 80.91.229.3 (17 Aug 2012 18:04:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2012 18:04:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 17 20:04:48 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T2Quc-0005Ra-CO for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 20:04:46 +0200 Original-Received: from localhost ([::1]:35508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Qub-0004yi-7H for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 14:04:45 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2QuW-0004yA-4c for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 14:04:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2QuU-0002cb-WA for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 14:04:40 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:44916) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2QuU-0002cQ-Lp for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 14:04:38 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1T2QuP-0005Ay-Hk for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 20:04:33 +0200 Original-Received: from dhcp-64-102-76-118.cisco.com ([64.102.76.118]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Aug 2012 20:04:33 +0200 Original-Received: from frazer.scott by dhcp-64-102-76-118.cisco.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 17 Aug 2012 20:04:33 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 22 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dhcp-64-102-76-118.cisco.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: <5C3FB161-5143-43E7-BF06-84B0D72468E0@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86401 Archived-At: On 8/17/12 10:20 AM, Perry Smith wrote: > Very often, I do a regex search (M-C-s) of \_ 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)