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

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

[elpa] externals/mines 5ee08ac 15/43: * mines.el (mines-mode): Initializ


From: Stefan Monnier
Subject: [elpa] externals/mines 5ee08ac 15/43: * mines.el (mines-mode): Initialize mode map in the body
Date: Mon, 30 Nov 2020 18:44:15 -0500 (EST)

branch: externals/mines
commit 5ee08ac05ffbc5aab129f9942593f9574fc79bc6
Author: Tino Calancha <tino.calancha@gmail.com>
Commit: Tino Calancha <tino.calancha@gmail.com>

    * mines.el (mines-mode): Initialize mode map in the body
---
 mines.el | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/mines.el b/mines.el
index 7f55e50..0039ed4 100644
--- a/mines.el
+++ b/mines.el
@@ -568,8 +568,8 @@ call this command again, the cell is unflagged."
   (mines-set-numbers)
   (mines-show))
 
-(defvar mines-mode-map
-  (let ((map (make-sparse-keymap 'mines-mode-map)))
+(define-derived-mode mines-mode special-mode "mines"
+  (let ((map mines-mode-map))
     (define-key map [right] 'mines-go-right)
     (define-key map "f" 'mines-go-right)
     (define-key map "l" 'mines-go-right)
@@ -587,11 +587,7 @@ call this command again, the cell is unflagged."
     ;; (define-key map "a" 'mines-flag-cell)
     (define-key map "1" 'mines-flag-cell)
     (define-key map "m" 'mines-flag-cell)
-    (define-key map "r" 'mines)
-    map)
-  "Mode map for `mines-mode'.")
-
-(define-derived-mode mines-mode special-mode "mines"
+    (define-key map "r" 'mines))
   "Major mode for playing Minesweeper.")
 
 



reply via email to

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