From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.help Subject: Re: keyboard regexp shortcuts Date: Sat, 18 Aug 2012 00:24:37 +0530 Message-ID: <87pq6pqrgy.fsf@gmail.com> References: <5C3FB161-5143-43E7-BF06-84B0D72468E0@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1345229674 8219 80.91.229.3 (17 Aug 2012 18:54:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2012 18:54:34 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Scott Frazer Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 17 20:54:34 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 1T2Rgj-00034J-5w for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 20:54:29 +0200 Original-Received: from localhost ([::1]:49204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Rgh-0006MB-VA for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 14:54:27 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Rgb-0006LZ-Qy for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 14:54:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2Rga-0000ue-TS for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 14:54:21 -0400 Original-Received: from mail-pb0-f41.google.com ([209.85.160.41]:41104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Rga-0000uP-Mi for help-gnu-emacs@gnu.org; Fri, 17 Aug 2012 14:54:20 -0400 Original-Received: by pbbro12 with SMTP id ro12so4153200pbb.0 for ; Fri, 17 Aug 2012 11:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=YZTKFUUVoMNI3f/HmLhXK0O4s1oE32jOUO0wuUN49ns=; b=MDGsI1tfzCQ51NuhycluasUkXsvYaPrQ919C0nor2uhNX2kTaCd8ZcRP+jWxDCBrmH BKI0FzNEff5waJ1VnDB2AzdGrQrREgfYO7A/ALnQ5cd/fvdLMrjn89hp+EPlwylEhCyx 9wlSE/Yav/SN36gKrDGFlB+1CH005F4l28ySxyFQot6lhRxN35umbGh5n10uuF5nS5rd 5EGiKCkRbvtBkZHa92Wg1w+isjJ3R1cc14tO4D4/ZSlaEH7j9jIVdhU2DwAqj5+6YuSx fJQtQ9iATegPk13539PAAWHQDs/gr/O+aQR/ULev0X8E91P+xLKs2z8C/C0O5AvzCsC9 CWUQ== Original-Received: by 10.68.129.168 with SMTP id nx8mr13616726pbb.112.1345229659455; Fri, 17 Aug 2012 11:54:19 -0700 (PDT) Original-Received: from debian-6.05 ([115.184.1.124]) by mx.google.com with ESMTPS id oq8sm5430726pbb.13.2012.08.17.11.54.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 17 Aug 2012 11:54:18 -0700 (PDT) In-Reply-To: (Scott Frazer's message of "Fri, 17 Aug 2012 14:04:25 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.41 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:86403 Archived-At: Scott Frazer writes: > 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) 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. `---- > > > > --