all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init.
       [not found] ` <E1WXrRK-0008Bt-55@vcs.savannah.gnu.org>
@ 2014-04-09 13:45   ` Stefan Monnier
  2014-04-09 14:12     ` Juanma Barranquero
  2014-04-09 18:57     ` Thien-Thi Nguyen
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-04-09 13:45 UTC (permalink / raw)
  To: emacs-devel

> +(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



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

* Re: [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init.
  2014-04-09 13:45   ` [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init Stefan Monnier
@ 2014-04-09 14:12     ` Juanma Barranquero
  2014-04-09 18:57     ` Thien-Thi Nguyen
  1 sibling, 0 replies; 6+ messages in thread
From: Juanma Barranquero @ 2014-04-09 14:12 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

On Wed, Apr 9, 2014 at 3:45 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> Or even using pcase-dolist:

Not documented, and not even autoloaded ;-)



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

* Re: [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init.
  2014-04-09 13:45   ` [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init Stefan Monnier
  2014-04-09 14:12     ` Juanma Barranquero
@ 2014-04-09 18:57     ` Thien-Thi Nguyen
  2014-04-10 13:12       ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Thien-Thi Nguyen @ 2014-04-09 18:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

() Stefan Monnier <monnier@IRO.UMontreal.CA>
() Wed, 09 Apr 2014 09:45:48 -0400

   > +(unless gnugo-frolic-mode-map
   > +  (setq gnugo-frolic-mode-map (make-sparse-keymap))
   > +  [...])

   Any reason not to use the standard

      (defvar gnugo-frolic-mode-map
        (let ((map (make-sparse-keymap)))
          [...]
          map))

   Or even using pcase-dolist:

      (defvar gnugo-frolic-mode-map
        (let ((map (make-sparse-keymap)))
          (suppress-keymap map)
          (pcase-dolist [...])
          map))

Well, the latter is still scary to this pre-‘dolist’-w/o-cl.el dinosaur,
although it certainly looks sveltely attractive (modulo backticks, but i
suppose they are unavoidable for ‘pcase’).

More disturbing is seeing a huge form early in the file, w/ many forward
references; i prefer to maintain top-level forms topo-sorted as much as
possible (surely a sign of C/Scheme braindamage -- call a doctor!).

But anyway, i'll stew on it for a while; thanks for the suggestion.

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init.
  2014-04-09 18:57     ` Thien-Thi Nguyen
@ 2014-04-10 13:12       ` Stefan Monnier
  2014-04-10 20:39         ` Thien-Thi Nguyen
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2014-04-10 13:12 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: emacs-devel

> More disturbing is seeing a huge form early in the file, w/ many forward
> references; i prefer to maintain top-level forms topo-sorted as much as
> possible (surely a sign of C/Scheme braindamage -- call a doctor!).

If you like forward declarations, then put a (defvar
gnugo-frolic-mode-map), i.e. just a declaration *without*
initialization, early in the file.


        Stefan



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

* Re: [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init.
  2014-04-10 13:12       ` Stefan Monnier
@ 2014-04-10 20:39         ` Thien-Thi Nguyen
  2014-04-10 22:25           ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Thien-Thi Nguyen @ 2014-04-10 20:39 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

() Stefan Monnier <monnier@IRO.UMontreal.CA>
() Thu, 10 Apr 2014 09:12:13 -0400

   If you like forward declarations, then put a (defvar
   gnugo-frolic-mode-map), i.e. just a declaration *without*
   initialization, early in the file.

Hmm, does that permit a docstring somehow?

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init.
  2014-04-10 20:39         ` Thien-Thi Nguyen
@ 2014-04-10 22:25           ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-04-10 22:25 UTC (permalink / raw)
  To: emacs-devel

>    If you like forward declarations, then put a (defvar
>    gnugo-frolic-mode-map), i.e. just a declaration *without*
>    initialization, early in the file.

> Hmm, does that permit a docstring somehow?

No, it's just a forward declaration.  The subsequent real `defvar'
should contain the docstring.


        Stefan



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

end of thread, other threads:[~2014-04-10 22:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20140409121712.31423.53123@vcs.savannah.gnu.org>
     [not found] ` <E1WXrRK-0008Bt-55@vcs.savannah.gnu.org>
2014-04-09 13:45   ` [elpa] 01/03: [gnugo frolic int] Regularize keymap decl + init Stefan Monnier
2014-04-09 14:12     ` 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

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.