From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: emacs-devel@gnu.org
Subject: Re: [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init.
Date: Wed, 09 Apr 2014 09:45:48 -0400 [thread overview]
Message-ID: <jwva9buwrfi.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <E1WXrRK-0008Bt-55@vcs.savannah.gnu.org> (Thien-Thi Nguyen's message of "Wed, 09 Apr 2014 12:17:14 +0000")
> +(unless gnugo-frolic-mode-map
> + (setq gnugo-frolic-mode-map (make-sparse-keymap))
> + (suppress-keymap gnugo-frolic-mode-map)
> + (mapc (lambda (pair)
> + (define-key gnugo-frolic-mode-map (car pair) (cdr pair)))
> + '(("q" . gnugo-frolic-quit)
> + ("C" . gnugo-frolic-quit) ; like ‘View-kill-and-leave’
> + ("\C-b" . gnugo-frolic-backward-branch)
> + ("\C-f" . gnugo-frolic-forward-branch)
> + ("j" . gnugo-frolic-exchange-left)
> + ("J" . gnugo-frolic-rotate-left)
> + ("k" . gnugo-frolic-exchange-right)
> + ("K" . gnugo-frolic-rotate-right)
> + ("\C-m" . gnugo-frolic-set-as-main-line)
> + ("\C-\M-p" . gnugo-frolic-prune-branch)
> + ("o" . gnugo-frolic-return-to-origin))))
Any reason not to use the standard
(defvar gnugo-frolic-mode-map
(let ((map (make-sparse-keymap)))
(suppress-keymap map)
(mapc (lambda (pair)
(define-key map (car pair) (cdr pair)))
'(("q" . gnugo-frolic-quit)
("C" . gnugo-frolic-quit) ; like ‘View-kill-and-leave’
("\C-b" . gnugo-frolic-backward-branch)
("\C-f" . gnugo-frolic-forward-branch)
("j" . gnugo-frolic-exchange-left)
("J" . gnugo-frolic-rotate-left)
("k" . gnugo-frolic-exchange-right)
("K" . gnugo-frolic-rotate-right)
("\C-m" . gnugo-frolic-set-as-main-line)
("\C-\M-p" . gnugo-frolic-prune-branch)
("o" . gnugo-frolic-return-to-origin)))
map))
Or even using pcase-dolist:
(defvar gnugo-frolic-mode-map
(let ((map (make-sparse-keymap)))
(suppress-keymap map)
(pcase-dolist (`(,key . ,cmd)
'(("q" . gnugo-frolic-quit)
("C" . gnugo-frolic-quit) ; like ‘View-kill-and-leave’
("\C-b" . gnugo-frolic-backward-branch)
("\C-f" . gnugo-frolic-forward-branch)
("j" . gnugo-frolic-exchange-left)
("J" . gnugo-frolic-rotate-left)
("k" . gnugo-frolic-exchange-right)
("K" . gnugo-frolic-rotate-right)
("\C-m" . gnugo-frolic-set-as-main-line)
("\C-\M-p" . gnugo-frolic-prune-branch)
("o" . gnugo-frolic-return-to-origin))
(define-key map key cmd)))
map))
-- Stefan
next parent reply other threads:[~2014-04-09 13:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140409121712.31423.53123@vcs.savannah.gnu.org>
[not found] ` <E1WXrRK-0008Bt-55@vcs.savannah.gnu.org>
2014-04-09 13:45 ` Stefan Monnier [this message]
2014-04-09 14:12 ` [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init Juanma Barranquero
2014-04-09 18:57 ` Thien-Thi Nguyen
2014-04-10 13:12 ` Stefan Monnier
2014-04-10 20:39 ` Thien-Thi Nguyen
2014-04-10 22:25 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwva9buwrfi.fsf-monnier+emacsdiffs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.