[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how-many/count-matches for non-interactive use
From: |
Robert J. Chassell |
Subject: |
Re: how-many/count-matches for non-interactive use |
Date: |
Wed, 20 Oct 2004 09:28:53 -0400 (EDT) |
As Luc Teirlinck said,
A keyboard macro is a poor man's Lisp function.
Ten or twelve years ago, GNU Emacs Calc contained a function that
converted keyboard macros to GNU Emacs Lisp functions. It might be
useful to focus again on this. Such a conversion function might help
novices and those who put short expressions in their .emacs files.
The original conversion function was not very good. It did not print
the resulting defun right and it did not take arguments. It changed a
few commands to others. But it was good enough as a beginning.
For example, if I remember rightly, the conversion function could take
a keyboard macro named `foo'
C-x ( C-s Emacs C-b C-b C-b C-b C-b GNU C-n C-a C-x )
and create a function that looked like this:
(defun foo ()
(interactive)
(search-forward "Emacs")
(backward-char)
(backward-char)
(backward-char)
(backward-char)
(backward-char)
(insert "G")
(insert "N")
(insert "U")
(insert " ")
(next-line)
(beginning-of-line))
(except that the result was more poorly pretty printed), rather than
this:
C-s Emacs 5*C-b GNU SPC C-n C-a
or
(fset 'foo
(lambda (&optional arg) "Keyboard macro." (interactive "p")
(kmacro-exec-ring-item (quote ("EmacsGNU " 0 "%d")) arg)))
I lost interest in the function and now cannot find it. Either I have
not looked well enough or it has been removed from the sources.
Interestingly, the `kmacro-edit-macro-repeat' command (`C-x C-k C-e')
lists command names as comments. Perhaps the fairly deficient
conversion function transmogrified into this command.
--
Robert J. Chassell
address@hidden GnuPG Key ID: 004B4AC8
http://www.rattlesnake.com http://www.teak.cc
- Re: how-many/count-matches for non-interactive use, (continued)
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/19
- Re: how-many/count-matches for non-interactive use, Kim F. Storm, 2004/10/19
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/20
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/20
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/19
- Re: how-many/count-matches for non-interactive use, David Kastrup, 2004/10/19
- Re: how-many/count-matches for non-interactive use,
Robert J. Chassell <=
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/19
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/20
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/20
- Re: how-many/count-matches for non-interactive use, Richard Stallman, 2004/10/22
- Convert keyboard macros to Lisp (was: how-many/count-matches for non-interactive use), Juri Linkov, 2004/10/22
- Re: Convert keyboard macros to Lisp (was: how-many/count-matches for non-interactive use), Richard Stallman, 2004/10/23
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/22
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/22
- Re: how-many/count-matches for non-interactive use, Luc Teirlinck, 2004/10/22
- Re: how-many/count-matches for non-interactive use, John Paul Wallington, 2004/10/23