From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: isearch and yank word doubt Date: Thu, 30 May 2013 22:57:36 -0600 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1369976234 3056 80.91.229.3 (31 May 2013 04:57:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 May 2013 04:57:14 +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 May 31 06:57:08 2013 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 1UiHOm-0000Qg-6W for geh-help-gnu-emacs@m.gmane.org; Fri, 31 May 2013 06:57:08 +0200 Original-Received: from localhost ([::1]:41976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiHOl-0005Jn-TZ for geh-help-gnu-emacs@m.gmane.org; Fri, 31 May 2013 00:57:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiHOb-0005Jg-FJ for help-gnu-emacs@gnu.org; Fri, 31 May 2013 00:56:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiHOX-0007Au-UQ for help-gnu-emacs@gnu.org; Fri, 31 May 2013 00:56:57 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:41192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiHOX-0007An-Nq for help-gnu-emacs@gnu.org; Fri, 31 May 2013 00:56:53 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UiHOU-0000JU-0p for help-gnu-emacs@gnu.org; Fri, 31 May 2013 06:56:50 +0200 Original-Received: from 70-59-7-113.hlrn.qwest.net ([70.59.7.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 May 2013 06:56:50 +0200 Original-Received: from kevin.d.rodgers by 70-59-7-113.hlrn.qwest.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 May 2013 06:56:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 28 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 70-59-7-113.hlrn.qwest.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 In-Reply-To: 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:91194 Archived-At: On 5/30/13 12:42 AM, Luca Ferrari wrote: > Hi all, > according to the manual the C-s C-w yanks the next word the cursor is > on as the string to search with isearch. Often I found myself having > the cursor in the middle of a word, so I have to go back to the > beginning and then do the yank, is there a better way to instrument > C-s C-w to get the word the cursor is in? I like it! (defun isearch-yank-word-at-point () "Pull the word around point from buffer into search string." (interactive) ;; see isearch-yank-word-or-char and isearch-yank-internal: (isearch-yank-string (save-excursion (when (and (not isearch-forward) isearch-other-end) (goto-char isearch-other-end)) (when (= (char-syntax (or (char-after (1- (point))) 0)) ?w) (forward-word -1)) (buffer-substring-no-properties (point) (progn (forward-word 1) (point)))))) (define-key isearch-mode-map "\C-w" 'isearch-yank-word-at-point) -- Kevin Rodgers Denver, Colorado, USA