unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Editing keyboard macros
@ 2004-09-29 19:05 Jay Belanger
  2004-09-29 23:33 ` Kim F. Storm
  0 siblings, 1 reply; 7+ messages in thread
From: Jay Belanger @ 2004-09-29 19:05 UTC (permalink / raw)
  Cc: belanger


When a keyboard macro is edited, it is assumed that the macro is an
array.  However, `kmacro-name-last-macro' and 'kmacro-bind-to-key' now
put the macro in a lambda expression, and so `edit-kbd-macro' gives an
error if you try to edit a named macro.  Should the naming of macros
be reverted to storing them as arrays?  
(`edit-kbd-macro' could be partially rewritten, I suppose, but that
would be more work.  I assume that the named keyboard macros are
stored as lambda expressions so they can be called from lisp (which
would make the docstrings out of date).  But the ability to edit a
keyboard macro seems like too much to lose.)

Jay

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

* Re: Editing keyboard macros
  2004-09-29 19:05 Editing keyboard macros Jay Belanger
@ 2004-09-29 23:33 ` Kim F. Storm
  2004-09-30 13:29   ` Kim F. Storm
  0 siblings, 1 reply; 7+ messages in thread
From: Kim F. Storm @ 2004-09-29 23:33 UTC (permalink / raw)
  Cc: emacs-devel

Jay Belanger <belanger@truman.edu> writes:

> When a keyboard macro is edited, it is assumed that the macro is an
> array.  However, `kmacro-name-last-macro' and 'kmacro-bind-to-key' now
> put the macro in a lambda expression, and so `edit-kbd-macro' gives an
> error if you try to edit a named macro.  Should the naming of macros
> be reverted to storing them as arrays?  

There are good reasons for the change to lambda forms (to handle
per-macro counter and counter format), so that is not an option.

> (`edit-kbd-macro' could be partially rewritten, I suppose, but that
> would be more work.  I assume that the named keyboard macros are
> stored as lambda expressions so they can be called from lisp (which
> would make the docstrings out of date).  But the ability to edit a
> keyboard macro seems like too much to lose.)

I will fix edit-kbd-macro to handle kmacro generated lambda forms.

Thanks for reporting the problem.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Editing keyboard macros
  2004-09-29 23:33 ` Kim F. Storm
@ 2004-09-30 13:29   ` Kim F. Storm
  2004-09-30 19:39     ` Jay Belanger
  0 siblings, 1 reply; 7+ messages in thread
From: Kim F. Storm @ 2004-09-30 13:29 UTC (permalink / raw)
  Cc: emacs-devel

storm@cua.dk (Kim F. Storm) writes:

> I will fix edit-kbd-macro to handle kmacro generated lambda forms.

I have installed changes to handle this.  Please try them.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Editing keyboard macros
  2004-09-30 13:29   ` Kim F. Storm
@ 2004-09-30 19:39     ` Jay Belanger
  2004-09-30 20:29       ` Kim F. Storm
  0 siblings, 1 reply; 7+ messages in thread
From: Jay Belanger @ 2004-09-30 19:39 UTC (permalink / raw)
  Cc: belanger


storm@cua.dk (Kim F. Storm) writes:

> storm@cua.dk (Kim F. Storm) writes:
>
>> I will fix edit-kbd-macro to handle kmacro generated lambda forms.
>
> I have installed changes to handle this.  Please try them.

Works great, thanks.
It doesn't work on keyboard macros that Calc saves, but that's a
problem with Calc that needs to be fixed.

Jay

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

* Re: Editing keyboard macros
  2004-09-30 19:39     ` Jay Belanger
@ 2004-09-30 20:29       ` Kim F. Storm
  2004-09-30 21:37         ` Jay Belanger
  0 siblings, 1 reply; 7+ messages in thread
From: Kim F. Storm @ 2004-09-30 20:29 UTC (permalink / raw)
  Cc: emacs-devel

Jay Belanger <belanger@truman.edu> writes:

> It doesn't work on keyboard macros that Calc saves, but that's a
> problem with Calc that needs to be fixed.

What's special about them ?
Can you show me an example ?

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Editing keyboard macros
  2004-09-30 20:29       ` Kim F. Storm
@ 2004-09-30 21:37         ` Jay Belanger
  2004-09-30 22:08           ` Kim F. Storm
  0 siblings, 1 reply; 7+ messages in thread
From: Jay Belanger @ 2004-09-30 21:37 UTC (permalink / raw)
  Cc: belanger, emacs-devel


>> It doesn't work on keyboard macros that Calc saves, but that's a
>> problem with Calc that needs to be fixed.
>
> What's special about them ?
> Can you show me an example ?

Mostly, I think, it uses `calc-execute-kbd-macro' instead of
`kmacro-exec-ring-item'.  There are other differences, the two macros
at the end of this message both enter "45 RET S".  
Calc keyboard macros are created in the usual way, but Calc saves it's
macros differently because using a kmacro saved macro in Calc will put
each part of it on the Calc trail and in the undo stack, using a Calc
saved keyboard macro will only put one item in the trail and stack.
(Calc does other things different, too.  When it attaches a macro to a
key, it makes it local to Calc.)
I'm thinking it might make sense to modify macedit.el, which came with
older versions of Calc, to create a special Calc keyboard macro
editing function.  macedit.el wasn't made part of Emacs when Calc was,
but it was written by Dave Gillespie.  Can anyone say if the copyright
papers he signed would also cover macedit.el?

Jay

(defun calc-User-g (&optional arg) 
 "Keyboard macro." 
 (interactive "p") 
 (kmacro-exec-ring-item (quote ([52 53 return 83] 0 "%d")) arg))

(defun calc-User-h (arg) 
  (interactive "P") 
  (calc-execute-kbd-macro ["4 5 <return> S" [52 53 return 83]] arg "zh"))

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

* Re: Editing keyboard macros
  2004-09-30 21:37         ` Jay Belanger
@ 2004-09-30 22:08           ` Kim F. Storm
  0 siblings, 0 replies; 7+ messages in thread
From: Kim F. Storm @ 2004-09-30 22:08 UTC (permalink / raw)
  Cc: emacs-devel

Jay Belanger <belanger@truman.edu> writes:

>>> It doesn't work on keyboard macros that Calc saves, but that's a
>>> problem with Calc that needs to be fixed.
>>
>> What's special about them ?
>> Can you show me an example ?
>
> Mostly, I think, it uses `calc-execute-kbd-macro' instead of
> `kmacro-exec-ring-item'.  There are other differences, the two macros
> at the end of this message both enter "45 RET S".  

I guess this could be handled by edmacro quite similar to the way I
handle kmacro macros.

I'll put it on my to-do list.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

end of thread, other threads:[~2004-09-30 22:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-29 19:05 Editing keyboard macros Jay Belanger
2004-09-29 23:33 ` Kim F. Storm
2004-09-30 13:29   ` Kim F. Storm
2004-09-30 19:39     ` Jay Belanger
2004-09-30 20:29       ` Kim F. Storm
2004-09-30 21:37         ` Jay Belanger
2004-09-30 22:08           ` Kim F. Storm

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