Re: Emacs manual desribes keyboard macros in the wrong section.

From:

Robert J. Chassell

Subject:

Re: Emacs manual desribes keyboard macros in the wrong section.

Date:

Fri, 28 Feb 2003 13:36:12 +0000 (UTC)

> I'm currently working on documenting the enhanced kmacro commands
> (ready in 1-2 weeks), ...
On a related issue:
A decade or more ago, Emacs possessed a command that would convert a
keyboard macro to an Emacs Lisp program starting with `defun'. Does
this program still exist? If so what is it called? I cannot find it.
Here is what I mean. As the manual says,
C-x ( C-a C-<SPC> C-n M-w C-x b f o o <RET> C-y C-x b <RET> C-x )
defines a macro that copies the current line into the buffer
`foo', then returns to the original buffer.
The old function, which may have been part of an early version of
Emacs Calc, would have produced a `defun' like this
(the optional doc string was in the wrong place):
(defun sample-kmacro () ""
(interactive)
(beginning-of-line)
(set-mark-command)
(next-line)
(kill-ring-save)
(switch-to-buffer "foo")
(yank)
(switch-to-buffer (other-buffer)))
Does the old function still exist? I would like to see it.
I cannot find the old function, and have always thought it interesting
as well as useful both in practice and as a teaching tool.
Currently, `insert-kbd-macro' produces this:
(fset 'sample-kmacro
[?\C-a ?\C- ?\C-n ?\M-w ?\C-x ?b ?f ?o ?o return ?\C-y ?\C-x ?b return])
Also, the `Keyboard Macro Editor' in the current distribution, in
`....emacs/lisp/edmacro.el', produces this when you type `C-x C-k RET'
(kmacro-edit-macro):
;; Keyboard Macro Editor. Press C-c C-c to finish;
;; Press C-x k RET to cancel.
;; Original keys: C-a C-SPC C-n M-w C-x b foo RET C-y C-x b RET
Command: last-kbd-macro
Key: none
Macro:
C-a ;; beginning-of-line
C-SPC ;; set-mark-command
C-n ;; next-line
M-w ;; kill-ring-save
C-x b ;; switch-to-buffer
foo ;; self-insert-command * 3
RET ;; newline
C-y ;; yank
C-x b ;; switch-to-buffer
RET ;; newline
As is, the current `insert-kbd-macro' and `kmacro-edit-macro' are
fine; but they are not as helpful as a program that converts
keystrokes to a `defun'.
--
Robert J. Chassell Rattlesnake Enterprises
http://www.rattlesnake.com GnuPG Key ID: 004B4AC8
http://www.teak.cc address@hidden