emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/gnugo f279f99 146/357: [gnugo frolic int] Regularize ke


From: Stefan Monnier
Subject: [elpa] externals/gnugo f279f99 146/357: [gnugo frolic int] Regularize keymap decl + init.
Date: Sun, 29 Nov 2020 14:51:09 -0500 (EST)

branch: externals/gnugo
commit f279f9961f574092ac7fdae77c79477277511b1a
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>

    [gnugo frolic int] Regularize keymap decl + init.
    
    * packages/gnugo/gnugo.el (gnugo-frolic-mode-map): New defvar.
    <top-level>: Conditionalize ‘gnugo-frolic-mode-map’
    init; use same idiom as for ‘gnugo-board-mode-map’.
---
 gnugo.el | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 7bab636..f042e7a 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -102,6 +102,9 @@ http://www.gnu.org/software/gnugo";)
 (defvar gnugo-board-mode-map nil
   "Keymap for GNUGO Board mode.")
 
+(defvar gnugo-frolic-mode-map nil
+  "Keymap for GNUGO Frolic mode.")
+
 (defvar gnugo-board-mode-hook nil
   "Hook run when entering GNUGO Board mode.")
 
@@ -2305,19 +2308,22 @@ starting a new one.  See `gnugo-board-mode' 
documentation for more info."
 ;;;---------------------------------------------------------------------------
 ;;; Load-time actions
 
-(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)))
+(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))))
 
 (unless gnugo-board-mode-map
   (setq gnugo-board-mode-map (make-sparse-keymap))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]