branch: elpa/pacmacs
commit a12795e835cd29beffbfb995ea7081f43678fc11
Author: rexim <[email protected]>
Commit: rexim <[email protected]>
Introduce pacmacs-scores-mode (#203)
---
pacmacs-score.el | 6 ++++--
pacmacs.el | 14 ++++++++------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/pacmacs-score.el b/pacmacs-score.el
index ae323122df..724a3bf6c0 100644
--- a/pacmacs-score.el
+++ b/pacmacs-score.el
@@ -81,8 +81,10 @@
(defun pacmacs--render-score-page (render-score-sign)
(funcall render-score-sign)
- (-> (pacmacs--read-score-table)
- (pacmacs--render-score-table)))
+ (let ((score-table (pacmacs--read-score-table)))
+ (if score-table
+ (pacmacs--render-score-table score-table)
+ (insert "(there are not records yet)"))))
(defun pacmacs--render-score-table (score-table)
(-each score-table #'pacmacs--render-score-record))
diff --git a/pacmacs.el b/pacmacs.el
index 93ed5d1f4d..7fbdc8163c 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -111,6 +111,13 @@
(setq cursor-type nil)
(setq truncate-lines t))
+(define-derived-mode pacmacs-scores-mode special-mode "Pacmacs Scores"
+ (define-key pacmacs-game-over-mode-map (kbd "q")
+ (-partial #'pacmacs--kill-buffer-and-its-window
+ pacmacs--score-buffer-name))
+ (setq cursor-type nil)
+ (setq truncate-lines t))
+
;;;###autoload
(defun pacmacs-start ()
(interactive)
@@ -731,12 +738,7 @@
(interactive)
(switch-to-buffer pacmacs--score-buffer-name)
-
- (text-mode)
- (read-only-mode 1)
- (setq truncate-lines t)
- (setq cursor-type nil)
-
+ (pacmacs-scores-mode)
(pacmacs--load-map-sign "scores")
(with-render-target pacmacs--score-buffer-name