From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: david@adboyd.com (J. David Boyd) Newsgroups: gmane.emacs.help Subject: Re: Keyboard macro with Isearch Date: Wed, 10 Aug 2005 09:55:18 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1123682589 4311 80.91.229.2 (10 Aug 2005 14:03:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 10 Aug 2005 14:03:09 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 10 16:03:09 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E2r9w-0000Ca-Dd for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Aug 2005 16:02:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E2rD3-0002su-4Q for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Aug 2005 10:05:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E2rBn-0002Jx-Dq for help-gnu-emacs@gnu.org; Wed, 10 Aug 2005 10:04:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E2rBh-0002GZ-4G for help-gnu-emacs@gnu.org; Wed, 10 Aug 2005 10:04:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E2rBf-0002FJ-Bp for help-gnu-emacs@gnu.org; Wed, 10 Aug 2005 10:04:07 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1E2rK4-00041k-7R for help-gnu-emacs@gnu.org; Wed, 10 Aug 2005 10:12:48 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1E2r3T-0007RM-Vf for help-gnu-emacs@gnu.org; Wed, 10 Aug 2005 15:55:40 +0200 Original-Received: from 6532248hfc164.tampabay.res.rr.com ([65.32.248.164]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Aug 2005 15:55:39 +0200 Original-Received: from david by 6532248hfc164.tampabay.res.rr.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Aug 2005 15:55:39 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 60 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 6532248hfc164.tampabay.res.rr.com User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:3gTDIqK0ufHrSxF3nxNEMIcBioQ= 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:28617 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:28617 "Aaron S. Hawley" writes: > Isearch doesn't play nice with keyboard macros. > > One of the simplest macros that could use Isearch would to be a simple > call of isearch-forward using C-s. The macro could be created with: > > C-x ( C-s C-x ) C-x C-k b C-. > > or evaluating: > > (global-set-key [?\C-.] "\C-s") > > Unfortunately, calling such a macro causes Isearch to halt taking > input rather than stay "interactive" and take input from the user for > the search string and continue highlighting any matches. > > The above is admittedly not a useful example, but I'm interested how > to store specific interactive searches with Isearch as macros, like > `C-s C-w' or anything more complicated, and then bounding them to > shorter key sequences like `C-.' or . Using the `C-s C-w' > example: > > C-x ( C-s C-w C-x ) C-x C-k b C-. > > or evaluating: > > (global-set-key [?\C-.] "\C-s\C-w") > > The search works by going to the end of the current word, but halts > and gives the message, "Mark saved where search started". > > It's not clear to me how create customizations for calling Isearch, > unless you use not only Emacs Lisp but make hacks useing Isearch's > internals. > > This code in the function isearch-done in file isearch.el looks like > at least one suspect for bias against macros: > > (or executing-kbd-macro (> (minibuffer-depth) 0) > (message "Mark saved where search started")))))) > > /a I've got this in my .emacs. It does a research regexp Isearch to look for a '{' as the only character on a line. I also have a corresponding one using regexp Isearch to move forward looking for a '}' on a line. (I use these in C programming). These don't stick after call Isearch. Maybe this would be a step in the right direction for you. (fset 'start-of-function [?\C-u ?\C-R ?^ ?{ ?$ ?\C-m]) (global-set-key (kbd "C-{") 'start-of-function) Dave in Largo, FL