[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Keyboard macro with Isearch
From: |
J. David Boyd |
Subject: |
Re: Keyboard macro with Isearch |
Date: |
Wed, 10 Aug 2005 09:55:18 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"Aaron S. Hawley" <ashawley@uvm.edu> 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 <f5>. 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