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

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

[nongnu] elpa/pacmacs 447882d2ef 439/472: Quit Game Over state with q ke


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs 447882d2ef 439/472: Quit Game Over state with q key (#202)
Date: Thu, 6 Jan 2022 21:59:47 -0500 (EST)

branch: elpa/pacmacs
commit 447882d2ef1bbe18fdb987ebd2f5de257c8a3d8a
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>

    Quit Game Over state with q key (#202)
---
 pacmacs.el | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/pacmacs.el b/pacmacs.el
index 536dae30c7..dfa9f2ea9d 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -95,7 +95,7 @@
   :type '(radio (const :tag "Default path")
                 (directory :tag "Custom path")))
 
-(define-derived-mode pacmacs-mode special-mode "pacmacs-mode"
+(define-derived-mode pacmacs-mode special-mode "Pacmacs"
   (define-key pacmacs-mode-map (kbd "<up>") 'pacmacs-up)
   (define-key pacmacs-mode-map (kbd "<down>") 'pacmacs-down)
   (define-key pacmacs-mode-map (kbd "<left>") 'pacmacs-left)
@@ -106,6 +106,11 @@
   (setq cursor-type nil)
   (setq truncate-lines t))
 
+(define-derived-mode pacmacs-game-over-mode special-mode "Pacmacs Game Over"
+  (define-key pacmacs-game-over-mode-map (kbd "q") 'pacmacs-quit)
+  (setq cursor-type nil)
+  (setq truncate-lines t))
+
 ;;;###autoload
 (defun pacmacs-start ()
   (interactive)
@@ -589,7 +594,8 @@
     (let ((nickname (widget-value widget)))
       (pacmacs--add-entry-to-score-table nickname score)
       (widget-value-set widget (pacmacs--align-score-record-nickname nickname))
-      (widget-delete widget))))
+      (widget-delete widget)
+      (pacmacs-game-over-mode))))
 
 (defun pacmacs--switch-to-game-over-state ()
   (pacmacs--load-map-sign "game-over")
@@ -623,11 +629,12 @@
             (plist-bind ((height :height))
                 pacmacs--object-board
               (goto-char (point-min))
-              (forward-line (+ height pacmacs--score-table-render-offset 
new-score-position))))
+              (forward-line (+ height pacmacs--score-table-render-offset 
new-score-position)))
+            (use-local-map widget-keymap)
+            (widget-setup))
         (pacmacs--render-score-table score-table)
-        (goto-char (point-min)))
-      (use-local-map widget-keymap)
-      (widget-setup))))
+        (goto-char (point-min))
+        (pacmacs-game-over-mode)))))
 
 (defun pacmacs--switch-to-play-state ()
   (setq pacmacs-game-state 'play)



reply via email to

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