all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: William Stevenson <yhvh2000@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Help with a big mode map
Date: Fri, 10 May 2013 21:52:29 +0100	[thread overview]
Message-ID: <87li7md0c2.fsf@gmail.com> (raw)

I create a huge mode map for the game board, one for each intersection of
lines, with entries like those below. Is there any way to collapse these
entries or alternately register a more generic map?

<A1>		Prefix Command
<B1>		Prefix Command
<A1> <mouse-1>	go-play-stone-mouse
<B1> <mouse-1>	go-play-stone-mouse

#+BEGIN_SRC elisp
;; Code lives at: https://github.com/yhvh/go-svg-mode

(defvar gosvg-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map "g" 'go-board-update)
    (define-key map "k" 'gosvg-cleanup)
    (define-key map "p" 'go-play-stone)
    (define-key map "P" 'go-play-pass)
    (define-key map "m" 'go-genmove)
    (define-key map "l" 'go-level-set)
    (define-key map "b" 'go-boardsize-set)
    (define-key map "u" 'go-undo)
    (define-key map "e" 'go-estimate-score)
    (define-key map "F" 'go-final-score)
    (define-key map "L" 'go-load-sgf)
    (define-key map "S" 'go-save-sgf)
    ;; The svg image has a map of circles which show the pointer as
    ;; hand and fire an event like: <D4 mouse-1>. Here I bind all these
    ;; events to `go-play-stone-mouse'. This results in a great many
    ;; entries in the keymap.
    (dolist (pos go-position-map)
      (eval
       `(define-key map (vector (car pos)  'mouse-1) 'go-play-stone-mouse)))
    map)
  "Keymap for `gosvg-mode'")
#+END_SRC




             reply	other threads:[~2013-05-10 20:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 20:52 William Stevenson [this message]
2013-05-10 21:25 ` Help with a big mode map Drew Adams
2013-05-11  2:27 ` 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=87li7md0c2.fsf@gmail.com \
    --to=yhvh2000@gmail.com \
    --cc=help-gnu-emacs@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.