From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Perry Smith Newsgroups: gmane.emacs.help Subject: Re: symbols verses words Date: Thu, 3 Mar 2011 08:14:12 -0600 Message-ID: <703145BE-ABE5-423F-8D2C-65B4F6A2515D@gmail.com> References: <06BF1211-A1CA-4E57-ADF4-8C89EF6ACDE1@gmail.com> <87ei6opktu.fsf@member.fsf.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1299161695 26575 80.91.229.12 (3 Mar 2011 14:14:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 Mar 2011 14:14:55 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 03 15:14:50 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pv9Ij-0005pP-Tv for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Mar 2011 15:14:46 +0100 Original-Received: from localhost ([127.0.0.1]:48834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pv9Ij-0006aN-Ba for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Mar 2011 09:14:45 -0500 Original-Received: from [140.186.70.92] (port=46560 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pv9IL-0006aI-9v for help-gnu-emacs@gnu.org; Thu, 03 Mar 2011 09:14:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pv9IG-0007G5-Ou for help-gnu-emacs@gnu.org; Thu, 03 Mar 2011 09:14:21 -0500 Original-Received: from mail-vx0-f169.google.com ([209.85.220.169]:47145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pv9IG-0007G1-HO for help-gnu-emacs@gnu.org; Thu, 03 Mar 2011 09:14:16 -0500 Original-Received: by vxc38 with SMTP id 38so1246001vxc.0 for ; Thu, 03 Mar 2011 06:14:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=efk6SAgXO4lto601+Ws/topXx443LY4nhNFdsuAtvZI=; b=wwsVgFA2eJtYVXn+PvWlrsHsgAoJT2jT4zHL0nB/Q5DkuYtac5yRjyV4t+fIO64HD2 sCKCOa4rQM+U1qAgdiaiPMGFiAZA6miovmnr+rHpaicZI8f5rogcYbUmkn595SNVOiu1 p3pxjXfd0X3TuyQkT1RHBnjFE7fcjIlkCjsfk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=U/bppeWP6O8OnPb3xlXQyNfQvAKCeiifNlGpdZFktsQ3ATcPTyZBKNi32xtLY6YfZu ba0VTO2YFzuTled9Mocg+W2AGLpHQmVu4rndtZ0yWDZzfGQa/R6iqzDINxnts/E1vSxg AhdPkc4Xfrx79fbfiCM4Pj00c5ZJ1MeiPFuQA= Original-Received: by 10.52.71.65 with SMTP id s1mr1867740vdu.104.1299161655418; Thu, 03 Mar 2011 06:14:15 -0800 (PST) Original-Received: from [10.0.0.2] ([64.128.19.234]) by mx.google.com with ESMTPS id c15sm489382vcs.31.2011.03.03.06.14.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Mar 2011 06:14:13 -0800 (PST) In-Reply-To: <87ei6opktu.fsf@member.fsf.org> X-Mailer: Apple Mail (2.1082) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:79745 Archived-At: On Mar 3, 2011, at 4:19 AM, Tassilo Horn wrote: > Perry Smith writes: > > Hi Perry, > >> I need some help understanding Emac's design. I use a lot of "word" >> constructs where I *think* I should be using symbol. For example, if >> I'm writing C code and I want to find foo but not foo_bar, I usually >> do \ but really it seems that I should be doing \_ >> ... fine. I can make that adjustment. But when I do incremental >> search, I often hit ^w to pull in the next word but what I really want >> (often but not always) is to pull in the next symbol (into the search >> string). So if I'm sitting at this_that, I'd ilke to hit ^W (perhaps) >> and pull in this_that instead of just this. > > I think, something like that should do the trick: > > --8<---------------cut here---------------start------------->8--- > (defun isearch-yank-symbol-or-char () > "Pull next character or symbol from buffer into search string." > (interactive) > (isearch-yank-internal > (lambda () > (if (or (memq (char-syntax (or (char-after) 0)) '(?w ?_)) > (memq (char-syntax (or (char-after (1+ (point))) 0)) '(?w ?_))) > (forward-symbol 1) > (forward-char 1)) > (point)))) > > (define-key isearch-mode-map (kbd "C-S-w") 'isearch-yank-symbol-or-char) > --8<---------------cut here---------------end--------------->8--- > > So when you are on a word constituent (?w) or on a symbol constituent > (?_), then do `forward-symbol', else `forward-char'. Thanks. The problem is that my emacs (GNU 23.2) doesn't have forward-symbol. I didn't know how to do that. Thanks again, Perry