From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: symbols verses words Date: Fri, 04 Mar 2011 10:06:49 +0100 Message-ID: <4D70ABA9.8040608@easy-emacs.de> References: <06BF1211-A1CA-4E57-ADF4-8C89EF6ACDE1@gmail.com> <87ei6opktu.fsf@member.fsf.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1299229447 9265 80.91.229.12 (4 Mar 2011 09:04:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 4 Mar 2011 09:04:07 +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 Mar 04 10:04:01 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 1PvQvZ-00014Z-0l for geh-help-gnu-emacs@m.gmane.org; Fri, 04 Mar 2011 10:04:01 +0100 Original-Received: from localhost ([127.0.0.1]:37575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvQvX-0001hY-OE for geh-help-gnu-emacs@m.gmane.org; Fri, 04 Mar 2011 04:03:59 -0500 Original-Received: from [140.186.70.92] (port=41091 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvQty-0001hE-Lf for help-gnu-emacs@gnu.org; Fri, 04 Mar 2011 04:02:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PvQtx-0007P0-KG for help-gnu-emacs@gnu.org; Fri, 04 Mar 2011 04:02:22 -0500 Original-Received: from moutng.kundenserver.de ([212.227.126.187]:51469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PvQtx-0007Om-8Y for help-gnu-emacs@gnu.org; Fri, 04 Mar 2011 04:02:21 -0500 Original-Received: from [192.168.178.29] (brln-4dbc4300.pool.mediaWays.net [77.188.67.0]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MMYTG-1PutSm3AP0-008JDY; Fri, 04 Mar 2011 10:02:19 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 In-Reply-To: <87ei6opktu.fsf@member.fsf.org> X-Provags-ID: V02:K0:VECT4BkiMPprOIiNorlBaiRoHMFKaiDFSNfCWWU0uh9 sJL+QdNmvosOLTJaLY1xsoI/w+63/uYJJKB9HgXH39ov6PdYFk h8mMAB6iKoaKfUGrWNTT9tHJ6fRJ3p3cPejbXW6Eq1eZGBTJon UFTk2KGdEV/m8KW9o6mc8WrLAus82UQ68+Tb6sVmXqPW9rjfgU C+EibWlz/gSs3QRThGiHbECmmDpnSUGnZKprmscfqo= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.126.187 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:79765 Archived-At: Am 03.03.2011 11:19, schrieb Tassilo Horn: > 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'. > > Bye, > Tassilo > > > Hi Tassilo, maybe I'm missing the point. In the case given may just extend input from `\w+' onto `\w+.\w' (?) Andreas