On Sun, Jul 26, 2009 at 9:23 PM, Adlai C<munchk...@gmail.com> wrote:
> I was reading about keymaps in the StumpWM manual, and I came across this
> example, on this page
> <http://www.nongnu.org/stumpwm/manual/stumpwm_2.html#SEC8>:
>
> (defvar *my-frame-bindings*
>   (let ((m (stumpwm:make-sparse-keymap)))
>     (stumpwm:define-key m (stumpwm:kbd "f") "curframe")
>     (stumpwm:define-key m (stumpwm:kbd "M-b") "move-focus left")
>     m ; NOTE: this is important
>   ))
>
> (stumpwm:define-key stumpwm:*root-map* (stumpwm:kbd "C-f")
> '*my-frame-bindings*)
>
> However, this seems to me more concise and also clearer to any non-lispers
> who may happen to browse StumpWM:
>
> (defvar *my-frame-bindings* (stumpwm:make-sparse-keymap))
> (stumpwm:define-key *my-frame-bindings* (stumpwm:kbd "f") "curframe")
> (stumpwm:define-key *my-frame-bindings* (stumpwm:kbd "M-b") "move-focus
> left")
> (stumpwm:define-key stumpwm:*root-map* (stumpwm:kbd "C-f")
> *my-frame-bindings*)

Yes that's probably easier to understand. The original uses a trick
that isn't useful in understanding keymaps.

> Also, note that I removed the quote before the frame name in the last
> definition -- that worked for me, and is simpler too.

This will work until you (setf *my-frame-bindings*
(stumpwm:make-sparse-keymap)) and then you'll have the old keymap
hanging around. I don't know if that's an issue.

-Shawn


_______________________________________________
Stumpwm-devel mailing list
Stumpwm-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/stumpwm-devel

Reply via email to