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

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

[nongnu] elpa/pacmacs 775a2d3ec5 211/472: Convert recorder module to a t


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs 775a2d3ec5 211/472: Convert recorder module to a tool (#115)
Date: Thu, 6 Jan 2022 21:59:25 -0500 (EST)

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

    Convert recorder module to a tool (#115)
---
 pacmacs-recorder.el  | 61 ---------------------------------------------
 tools/it-recorder.el | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 61 deletions(-)

diff --git a/pacmacs-recorder.el b/pacmacs-recorder.el
deleted file mode 100644
index 689fa201a2..0000000000
--- a/pacmacs-recorder.el
+++ /dev/null
@@ -1,61 +0,0 @@
-;;; pacmacs-recorder.el --- Pacman for Emacs
-
-;; Copyright (C) 2015 Codingteam
-
-;; Author: Codingteam <codingteam@conference.jabber.ru>
-;; Maintainer: Alexey Kutepov <reximkut@gmail.com>
-;; URL: http://github.com/rexim/pacmacs.el
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Routines for recording integration test cases
-
-;;; Code:
-
-(require 'cl-lib)
-
-(defvar pacmacs--tick-counter 0)
-(defvar pacmacs--recorded-actions nil)
-
-(defun pacmacs--reset-recorder ()
-  (setq pacmacs--tick-counter 0)
-  (setq pacmacs--recorded-actions nil))
-
-(defun pacmacs--save-test-case (filename)
-  (interactive "fFile to save the test case: ")
-  (with-temp-buffer
-    (-> score-table
-        (pp-to-string)
-        (insert))
-    (write-file filename)))
-
-(defun pacmacs--record-action (action-name)
-  (add-to-list 'pacmacs--recorded-actions
-               (cons action-name pacmacs--tick-counter)))
-
-(defun pacmacs--inc-tick-counter ()
-  (incf pacmacs--tick-counter))
-
-(provide 'pacmacs-recorder)
-
-;;; pacmacs-recorder.el ends here
diff --git a/tools/it-recorder.el b/tools/it-recorder.el
new file mode 100644
index 0000000000..de399dbfc4
--- /dev/null
+++ b/tools/it-recorder.el
@@ -0,0 +1,70 @@
+(require 'pacmacs)
+
+(require 'cl-lib)
+
+(defvar pacmacs--tick-counter 0)
+(defvar pacmacs--recorded-actions nil)
+
+(defun pacmacs--record-action (action-name)
+  (add-to-list 'pacmacs--recorded-actions
+               (cons action-name pacmacs--tick-counter)))
+
+(defun pacmacs--reset-recorder ()
+  (setq pacmacs--tick-counter 0)
+  (setq pacmacs--recorded-actions nil))
+
+(defun pacmacs--save-test-case (filename)
+  (interactive "FFile to save the test case: ")
+  (with-temp-buffer
+    (-> pacmacs--recorded-actions
+        (pp-to-string)
+        (insert))
+    (write-file filename)))
+
+(defun pacmacs-record-up ()
+  (interactive)
+  (pacmacs--record-action 'up)
+  (pacmacs-up))
+
+(defun pacmacs-record-down ()
+  (interactive)
+  (pacmacs--record-action 'down)
+  (pacmacs-down))
+
+(defun pacmacs-record-left ()
+  (interactive)
+  (pacmacs--record-action 'left)
+  (pacmacs-left))
+
+(defun pacmacs-record-right ()
+  (interactive)
+  (pacmacs--record-action 'right)
+  (pacmacs-right))
+
+(defun pacmacs-record-tick ()
+  (interactive)
+  (cl-incf pacmacs--tick-counter)
+  (pacmacs-tick))
+
+(define-derived-mode pacmacs-it-recorder-mode pacmacs-mode 
"pacmacs-it-recorder-mode"
+  (define-key pacmacs-it-recorder-mode-map (kbd "<up>") 'pacmacs-record-up)
+  (define-key pacmacs-it-recorder-mode-map (kbd "<down>") 'pacmacs-record-down)
+  (define-key pacmacs-it-recorder-mode-map (kbd "<left>") 'pacmacs-record-left)
+  (define-key pacmacs-it-recorder-mode-map (kbd "<right>") 
'pacmacs-record-right))
+
+(defun pacmacs--start-it-recorder ()
+  (interactive)
+  (switch-to-buffer pacmacs-buffer-name)
+  (pacmacs-it-recorder-mode)
+
+  (setq pacmacs-lives 3)
+  (setq pacmacs-score 0)
+  (setq pacmacs-levels (pacmacs--get-list-of-levels))
+  (setq pacmacs-current-level 0)
+  (pacmacs--reset-recorder)
+
+  (pacmacs--load-current-level)
+  (pacmacs--switch-to-play-state)
+
+  (unless pacmacs-timer
+    (setq pacmacs-timer (run-at-time nil (* pacmacs-tick-duration-ms 0.001) 
'pacmacs-record-tick))))



reply via email to

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