From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter West Newsgroups: gmane.emacs.help Subject: Modified isearch Date: Thu, 23 Jan 2014 23:40:37 +1000 Organization: Netfront http://www.netfront.net/ Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1390490065 31255 80.91.229.3 (23 Jan 2014 15:14:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jan 2014 15:14:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 23 16:14:33 2014 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 1W6LzF-0007Wb-3s for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Jan 2014 16:14:33 +0100 Original-Received: from localhost ([::1]:41739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6LzE-0002VC-MQ for geh-help-gnu-emacs@m.gmane.org; Thu, 23 Jan 2014 10:14:32 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!newsgate.cuhk.edu.hk!news.netfront.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 51 Original-NNTP-Posting-Host: 60.241.98.20 Original-X-Trace: adenine.netfront.net 1390484437 61400 60.241.98.20 (23 Jan 2014 13:40:37 GMT) Original-X-Complaints-To: news@netfront.net Original-NNTP-Posting-Date: Thu, 23 Jan 2014 13:40:37 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 Original-Xref: usenet.stanford.edu gnu.emacs.help:203303 X-Mailman-Approved-At: Thu, 23 Jan 2014 10:13:54 -0500 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:95574 Archived-At: I want to bind a variation of isearch to the C-c R key, based on comments in the Emacs Wiki page on isearch. Here are the suggestions from the wiki for leaving point at the beginning of the match. (add-hook 'isearch-mode-end-hook 'my-goto-match-beginning) (defun my-goto-match-beginning () (when (and isearch-forward isearch-other-end) (goto-char isearch-other-end))) (defadvice isearch-exit (after my-goto-match-beginning activate) "Go to beginning of match." (when (and isearch-forward isearch-other-end) (goto-char isearch-other-end))) With this hook, both ‘C-g’ and ‘RET’ exit the search at the begining of the search string. ... Another way to get the functionality of jumping to the beginning of the search-term is simply adding a little wrapper function and binding it to a different key. I find C-v a good candidate, you don’t usually want to jump to next page when searching: (define-key isearch-mode-map (kbd "C-v") 'my-isearch-forward-to-beginning) (defun my-isearch-forward-to-beginning () "Do a forward search and jump to the beginning of the search-term." (interactive) (isearch-repeat 'forward) (goto-char isearch-other-end)) ---------------- What I want to do is to invoke normal isearch and isearch-regexp functions (forward functions at least), and have the mark reset to the beginning of the matched text. So I tried this: (define-key search-map (kbd "C-c R") 'my-set-mark-point-around-isearch) (defun my-set-mark-point-around-isearch () "Do a forward search and set mark to the beginning of the search-term." (interactive) (isearch-forward) (push-mark isearch-other-end)) No luck. Can anyone advise me of the way to achieve this? Thanks. P --- news://freenews.netfront.net/ - complaints: news@netfront.net ---