From: Juri Linkov <juri@jurta.org>
To: avar@cpan.org (Ævar Arnfjörð Bjarmason)
Cc: yezonghui@gmail.com, emacs-devel@gnu.org
Subject: Re: Proposal for a insert-kbd-macro that inserts "real" elisp
Date: Fri, 04 Jan 2008 00:42:16 +0200 [thread overview]
Message-ID: <87abnm3513.fsf@jurta.org> (raw)
In-Reply-To: <86k5mrf2h4.fsf@cpan.org> ("Ævar Arnfjörð Bjarmason"'s message of "Thu, 03 Jan 2008 13:44:23 +0000")
> The following came up on
> http://www.emacswiki.org/cgi-bin/wiki/KeyboardMacrosTricks and I thought
> I'd post it here:
Are you aware of the recent efforts to implement this in Emacs?
http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg00038.html
>>> ChristopherSmith wrote:
>>> Is there a way to convert an existing keyboard macro to elisp code?
>>>
>>> The use-case for such a facility would be to explore the way emacs
>>> works internally. In cough MS Office cough applications, you can
>>> discover much about the object model from recording macros (though
>>> the comparison may be unfair). –
>> avar wrote:
>>
>> You can do this with M-x insert-kbd-macro but the result is probably
>> not to your liking. If I do:
>>
>> C-x (
>> C-n
>> foo
>> C-x )
>> M-x name-last-kbd-macro RET newline-and-foo
>> M-x insert-kbd-macro RET newline-and-foo RET
>>
>> emacs will insert the following into the buffer:
>>
>> (fset 'newline-and-foo
>> "\C-nfoo")
>>
>> I would very much like to be able to insert something like this:
>>
>> (defun newline-and-foo ()
>> (interactive)
>> (next-line)
>> (insert "foo"))
>>
>> But it appears emacs does not have this feature. A casual glance at
>> the source for insert-kbd-macro in macros.el would suggest that the
>> best way to go about this would be to write a function that called
>> (key-binding) on each key it was about to insert and inserted the
>> corresponding function name instead.
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2008-01-03 22:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 13:44 Proposal for a insert-kbd-macro that inserts "real" elisp Ævar Arnfjörð Bjarmason
2008-01-03 22:42 ` Juri Linkov [this message]
2008-01-04 5:36 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87abnm3513.fsf@jurta.org \
--to=juri@jurta.org \
--cc=avar@cpan.org \
--cc=emacs-devel@gnu.org \
--cc=yezonghui@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).