From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: symbols verses words Date: Thu, 03 Mar 2011 15:48:52 +0100 Message-ID: <87zkpcntt7.fsf@member.fsf.org> References: <06BF1211-A1CA-4E57-ADF4-8C89EF6ACDE1@gmail.com> <87ei6opktu.fsf@member.fsf.org> <703145BE-ABE5-423F-8D2C-65B4F6A2515D@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1299163782 6553 80.91.229.12 (3 Mar 2011 14:49:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 Mar 2011 14:49:42 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Perry Smith Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 03 15:49:37 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 1Pv9qR-0000Wa-ED for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Mar 2011 15:49:35 +0100 Original-Received: from localhost ([127.0.0.1]:47726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pv9qQ-00066x-Rm for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Mar 2011 09:49:34 -0500 Original-Received: from [140.186.70.92] (port=35624 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pv9ps-00064M-M8 for help-gnu-emacs@gnu.org; Thu, 03 Mar 2011 09:49:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pv9pn-00065O-Tq for help-gnu-emacs@gnu.org; Thu, 03 Mar 2011 09:49:00 -0500 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:9597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pv9pn-000654-PI for help-gnu-emacs@gnu.org; Thu, 03 Mar 2011 09:48:55 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id B7DD77816FEB; Thu, 3 Mar 2011 15:48:53 +0100 (CET) Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14832-08; Thu, 3 Mar 2011 15:48:52 +0100 (CET) X-CHKRCPT: Envelopesender noch tassilo@member.fsf.org Original-Received: from thinkpad (tsdh.uni-koblenz.de [141.26.67.142]) by deliver.uni-koblenz.de (Postfix) with ESMTP id C06337816FE1; Thu, 3 Mar 2011 15:48:52 +0100 (CET) In-Reply-To: <703145BE-ABE5-423F-8D2C-65B4F6A2515D@gmail.com> (Perry Smith's message of "Thu, 3 Mar 2011 08:14:12 -0600") User-Agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux) X-Virus-Scanned: amavisd-new at uni-koblenz.de X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 141.26.64.15 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:79750 Archived-At: Perry Smith writes: Hi Perry, >> 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. Ah, that function is defined in thingatpt.el, so you are only missing a (require 'thingatpt). Bye, Tassilo