[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs b96be7f8d8 402/472: Fix text read only problem (#1
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs b96be7f8d8 402/472: Fix text read only problem (#134) |
Date: |
Thu, 6 Jan 2022 21:59:43 -0500 (EST) |
branch: elpa/pacmacs
commit b96be7f8d8b0c2e89bc04e6e23c4123755b6352b
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Fix text read only problem (#134)
---
pacmacs.el | 68 ++++++++++++++++++++++++++++++++++----------------------------
1 file changed, 37 insertions(+), 31 deletions(-)
diff --git a/pacmacs.el b/pacmacs.el
index 18c950de4f..ae7df3f054 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -80,6 +80,8 @@
(defvar pacmacs-waiting-counter 0)
+(defvar pacmacs-game-over-state-rendered nil)
+
(define-derived-mode pacmacs-mode special-mode "pacmacs-mode"
(define-key pacmacs-mode-map (kbd "<up>") 'pacmacs-up)
(define-key pacmacs-mode-map (kbd "<down>") 'pacmacs-down)
@@ -106,6 +108,7 @@
(switch-to-buffer pacmacs-buffer-name)
(buffer-disable-undo pacmacs-buffer-name)
+ (setq pacmacs-game-over-state-rendered nil)
(setq pacmacs-lives 3)
(setq pacmacs-score 0)
(setq pacmacs-levels (pacmacs--get-list-of-levels))
@@ -557,14 +560,14 @@
(pacmacs-load-anim "Red-Ghost-Win"))))
(defun pacmacs--switch-to-game-over-state ()
- (setq pacmacs-game-state 'game-over)
-
(pacmacs--load-map "game-over")
(pacmacs-destroy)
+ (setq pacmacs-game-state 'game-over)
(pacmacs--render-state)
(pacmacs-game-over-mode)
- (read-only-mode 0))
+ (read-only-mode 0)
+ (put-text-property (point-min) (point-max) 'read-only t))
(defun pacmacs--switch-to-play-state ()
(setq pacmacs-game-state 'play)
@@ -597,34 +600,37 @@
(pacmacs--put-object wall)))
(defun pacmacs--render-state ()
- (with-current-buffer pacmacs-buffer-name
- (let ((inhibit-read-only t))
- (erase-buffer)
-
- (insert (format "Score: %d\n\n" pacmacs-score))
-
- (when pacmacs-debug-output
- (pacmacs--render-track-board pacmacs--track-board))
-
- (plist-bind ((width :width)
- (height :height))
- pacmacs--object-board
- (dotimes (row height)
- (dotimes (column width)
- (let ((anim-object (car (pacmacs--cell-wrapped-get
pacmacs--object-board
- row column))))
- (pacmacs--render-object anim-object)))
- (insert "\n")))
- (insert "\n")
- (dotimes (i pacmacs-lives)
- (ignore i)
- (pacmacs--render-life-icon))
-
- (when (equal pacmacs-game-state 'game-over)
- (-> (pacmacs--read-score-table)
- (pacmacs--sort-score-table)
- (pacmacs--render-score-table)))
- (goto-char 0))))
+ (when (or (not (equal pacmacs-game-state 'game-over))
+ (not pacmacs-game-over-state-rendered))
+ (with-current-buffer pacmacs-buffer-name
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+
+ (insert (format "Score: %d\n\n" pacmacs-score))
+
+ (when pacmacs-debug-output
+ (pacmacs--render-track-board pacmacs--track-board))
+
+ (plist-bind ((width :width)
+ (height :height))
+ pacmacs--object-board
+ (dotimes (row height)
+ (dotimes (column width)
+ (let ((anim-object (car (pacmacs--cell-wrapped-get
pacmacs--object-board
+ row column))))
+ (pacmacs--render-object anim-object)))
+ (insert "\n")))
+ (insert "\n")
+ (dotimes (i pacmacs-lives)
+ (ignore i)
+ (pacmacs--render-life-icon))
+
+ (when (equal pacmacs-game-state 'game-over)
+ (setq pacmacs-game-over-state-rendered t)
+ (-> (pacmacs--read-score-table)
+ (pacmacs--sort-score-table)
+ (pacmacs--render-score-table)))
+ (goto-char 0)))))
(defun pacmacs--unpaused-play-state-p ()
(and (equal pacmacs-game-state 'play)
- [nongnu] elpa/pacmacs fa83e10d82 325/472: Get rid of dup code in track object mech (#159), (continued)
- [nongnu] elpa/pacmacs fa83e10d82 325/472: Get rid of dup code in track object mech (#159), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 51117fc5db 336/472: Rename 5th big pill level accordingly (#162), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0a33c04fc1 333/472: Add fourth big pill level (#162), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 402d176003 339/472: Remove unused functions (#171), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 71b977fd22 343/472: Transform it-recorder.el to an additional module, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ad5cdc8efd 349/472: Add att.txt to gitignore, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 8d63cc3f30 358/472: Multicolor walls (#138), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs aed2853780 373/472: Move wall weight to the constants (#138), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 8166e4d3d7 363/472: Merge pull request #181 from codingteam/terrified-timer-reset-173, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4679fcef60 381/472: Fix put-horizontal-bar UT (#138), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b96be7f8d8 402/472: Fix text read only problem (#134),
ELPA Syncer <=
- [nongnu] elpa/pacmacs 8836f12761 410/472: Kill the game buffer on initialization (#134), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 689c09287c 423/472: Add UT for step-ghosts func, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0126187ee8 428/472: Merge pull request #197 from codingteam/sorting-score-table-on-read-write-194, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 988c61b190 432/472: Load leves from custom folder (#191), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 23d315e54f 437/472: Trigger MELPA update, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 66dd6b0aee 446/472: Enable truncate lines for score table (#203), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 25385d9337 458/472: Add toggle-debug-output function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e7abee5bd3 091/472: Lazy init of empty cell (#70), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs af3407e676 047/472: Sprite sheets as part of anim object. Close #24, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs edf7b2d1b3 069/472: Use plist-bind macro for pacman-anim-get-frame (#54), ELPA Syncer, 2022/01/06