unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Help with a big mode map
@ 2013-05-10 20:52 William Stevenson
  2013-05-10 21:25 ` Drew Adams
  2013-05-11  2:27 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: William Stevenson @ 2013-05-10 20:52 UTC (permalink / raw)
  To: help-gnu-emacs

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




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

* RE: Help with a big mode map
  2013-05-10 20:52 Help with a big mode map William Stevenson
@ 2013-05-10 21:25 ` Drew Adams
  2013-05-11  2:27 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2013-05-10 21:25 UTC (permalink / raw)
  To: 'William Stevenson', help-gnu-emacs

> 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?

I don't understand the question; sorry.

I see what you are doing, but I do not see what you want to do.




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

* Re: Help with a big mode map
  2013-05-10 20:52 Help with a big mode map William Stevenson
  2013-05-10 21:25 ` Drew Adams
@ 2013-05-11  2:27 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2013-05-11  2:27 UTC (permalink / raw)
  To: help-gnu-emacs

>       (eval
>        `(define-key map (vector (car pos)  'mouse-1) 'go-play-stone-mouse)))

Huh?  Why not just

   (define-key map (vector (car pos)  'mouse-1) 'go-play-stone-mouse)

??


        Stefan "if you think you need `eval' please ask for help"




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

end of thread, other threads:[~2013-05-11  2:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-10 20:52 Help with a big mode map William Stevenson
2013-05-10 21:25 ` Drew Adams
2013-05-11  2:27 ` Stefan Monnier

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