unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Proposal for a insert-kbd-macro that inserts "real" elisp
@ 2008-01-03 13:44 Ævar Arnfjörð Bjarmason
  2008-01-03 22:42 ` Juri Linkov
  0 siblings, 1 reply; 3+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2008-01-03 13:44 UTC (permalink / raw)
  To: emacs-devel


The following came up on
http://www.emacswiki.org/cgi-bin/wiki/KeyboardMacrosTricks and I thought
I'd post it here:

>> 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.

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

* Re: Proposal for a insert-kbd-macro that inserts "real" elisp
  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
  2008-01-04  5:36   ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2008-01-03 22:42 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: yezonghui, emacs-devel

> 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/

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

* Re: Proposal for a insert-kbd-macro that inserts "real" elisp
  2008-01-03 22:42 ` Juri Linkov
@ 2008-01-04  5:36   ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 3+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2008-01-04  5:36 UTC (permalink / raw)
  To: Juri Linkov; +Cc: yezonghui, emacs-devel

Juri Linkov <juri@jurta.org> writes:

>> 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 

No I was not. I just thought this was a feature emacs should
have. Thanks for pointing this out.

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

end of thread, other threads:[~2008-01-04  5:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-01-04  5:36   ` Ævar Arnfjörð Bjarmason

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).