unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Keyboard macro with Isearch
@ 2005-08-10  2:40 Aaron S. Hawley
  2005-08-10 13:55 ` J. David Boyd
  0 siblings, 1 reply; 6+ messages in thread
From: Aaron S. Hawley @ 2005-08-10  2:40 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Keyboard macro with Isearch
  2005-08-10  2:40 Keyboard macro with Isearch Aaron S. Hawley
@ 2005-08-10 13:55 ` J. David Boyd
  2005-08-11 17:44   ` Kevin Rodgers
  0 siblings, 1 reply; 6+ messages in thread
From: J. David Boyd @ 2005-08-10 13:55 UTC (permalink / raw)


"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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Keyboard macro with Isearch
  2005-08-10 13:55 ` J. David Boyd
@ 2005-08-11 17:44   ` Kevin Rodgers
  2005-08-11 19:32     ` J. David Boyd
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2005-08-11 17:44 UTC (permalink / raw)


J. David Boyd wrote:
 > 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)

I don't know what you mean by "stick after call Isearch".  But these
avoid the problem reported by the OP by explicitly terminating isearch,
with C-m.

And to find the beginning or end of a function definition, Emacs already
has C-M-a and C-M-e.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Keyboard macro with Isearch
  2005-08-11 17:44   ` Kevin Rodgers
@ 2005-08-11 19:32     ` J. David Boyd
  0 siblings, 0 replies; 6+ messages in thread
From: J. David Boyd @ 2005-08-11 19:32 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> J. David Boyd wrote:
>  > 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)
>
> I don't know what you mean by "stick after call Isearch".  But these
> avoid the problem reported by the OP by explicitly terminating isearch,
> with C-m.

That's what I meant by 'stick'... Sorry for the sloppy nomenclature...

>
> And to find the beginning or end of a function definition, Emacs already
> has C-M-a and C-M-e.
>

Ha!  I've been using emacs for 8 years now, and I didn't know that.  Thanks
for the info!  (I do like my mapping better, so maybe I'll reset my defaults)

Dave in Largo, FL

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Keyboard macro with Isearch
       [not found] <Pine.A41.4.58.0508221345420.39610@elk.uvm.edu>
@ 2005-08-22 17:55 ` Aaron S. Hawley
  2005-10-29 15:45   ` Aaron S. Hawley
  0 siblings, 1 reply; 6+ messages in thread
From: Aaron S. Hawley @ 2005-08-22 17:55 UTC (permalink / raw)


After the confusion from my original post, I am still looking for a
solution to the "keyboard macros with Isearch" problem.

Kevin Boyd's response though not helpful for my problem does show exactly
what the problem is with Isearch.  If one wanted an Emacs macro using
Isearch to terminate a search, then one could explicityly add `RET' (or
for Kevin `C-m')  to terminate the search.  But even without `RET', a
macro using search terminates the search when the macro ends, rather than
keeping the search interactive.

I wrote on 9 August 2005:

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Keyboard macro with Isearch
  2005-08-22 17:55 ` Aaron S. Hawley
@ 2005-10-29 15:45   ` Aaron S. Hawley
  0 siblings, 0 replies; 6+ messages in thread
From: Aaron S. Hawley @ 2005-10-29 15:45 UTC (permalink / raw)


This problem is now a much shorter bug report:

<http://lists.gnu.org/archive/html/bug-gnu-emacs/2005-10/msg00534.html>

/a

I wrote on Mon, 22 Aug 2005,

> After the confusion from my original post, I am still looking for a
> solution to the "keyboard macros with Isearch" problem.
>
> Kevin Boyd's response though not helpful for my problem does show exactly
> what the problem is with Isearch.  If one wanted an Emacs macro using
> Isearch to terminate a search, then one could explicityly add `RET' (or
> for Kevin `C-m')  to terminate the search.  But even without `RET', a
> macro using search terminates the search when the macro ends, rather than
> keeping the search interactive.
>
> I wrote on 9 August 2005:
>
> > 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-10-29 15:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-10  2:40 Keyboard macro with Isearch Aaron S. Hawley
2005-08-10 13:55 ` J. David Boyd
2005-08-11 17:44   ` Kevin Rodgers
2005-08-11 19:32     ` J. David Boyd
     [not found] <Pine.A41.4.58.0508221345420.39610@elk.uvm.edu>
2005-08-22 17:55 ` Aaron S. Hawley
2005-10-29 15:45   ` Aaron S. Hawley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).