Steve Youngs <steve@xxxxxxxx> writes:
> * Steve Youngs <steve@xxxxxxxx> writes:
>
> > But I want to save this very important macro across XWEM sessions.
> > And this is where I get lost. What are the XWEM equivalents of:
>
> > `name-last-kbd-macro'
> > `assign-last-kbd-macro-to-key'
> > `insert-kbd-macro'
>
> To followup to myself, this solves my immediate problems...
>
> (define-xwem-command xwem-assign-last-kbd-macro-to-key (key)
> "Assign to a key sequence the last keyboard macro defined.
> Argument KEY is anything acceptable to `define-key'.."
> (xwem-interactive
> (list (read-key-sequence "Key sequence for last kbd macro: ")))
> (or xwem-keymacro-last-kbd-macro
> (error "No keyboard macro defined"))
> (define-key xwem-user-macros-map key xwem-keymacro-last-kbd-macro))
>
> And then xwem-desktop-(save|load) handles the rest.
Yes, that is exactly how it should be done. But it is better to use
"K" interactive form, like this:
(define-xwem-command xwem-assign-last-kbd-macro-to-key (key)
"documentation"
(xwem-interactive "KKey sequence for last kbd macro: ")
...)
>
> This looks OK for simplistic keyboard macros, but I'd imagine it would
> get quite untidy for anything complex.
>
> I'm working on `xwem-name-last-kbd-macro' and
> `xwem-insert-kbd-macro'. :-)
Hehe, thats great!
PS: to assign keyboard macro to key at definition time use prefix arg
(H-u) before H-x (, like this `H-u H-x ( m a c r o H-x )' - after `H-x
)' it will propose you to select a key in xwem-user-macros-map to bind
to.
--
lg
|