Skip to content

Commit

Permalink
Add pacmacs-replay-finished-hook
Browse files Browse the repository at this point in the history
It will help to write scripts for automated it cases replaying
  • Loading branch information
rexim committed Dec 6, 2015
1 parent 71b977f commit 375d85e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tools/pacmacs-rr.el
Expand Up @@ -42,6 +42,7 @@
(defvar pacmacs--tick-counter 0)
(defvar pacmacs--recorded-actions nil)
(defvar pacmacs--tick-times nil)
(defvar pacmacs-replay-finished-hook nil)

(defun pacmacs--record-action (action-name)
(add-to-list 'pacmacs--recorded-actions
Expand Down Expand Up @@ -97,12 +98,13 @@
(pacmacs--measure-time
(pacmacs-tick)))

(if (not pacmacs--recorded-actions)
(pacmacs-quit)
(-let ((((action . tick-number) . _) pacmacs--recorded-actions))
(when (= tick-number pacmacs--tick-counter)
(funcall action)
(setq pacmacs--recorded-actions (cdr pacmacs--recorded-actions))))))
(if pacmacs--recorded-actions
(-let ((((action . tick-number) . _) pacmacs--recorded-actions))
(when (= tick-number pacmacs--tick-counter)
(funcall action)
(setq pacmacs--recorded-actions (cdr pacmacs--recorded-actions))))
(pacmacs-quit)
(run-hooks 'pacmacs-replay-finished-hook)))

(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)
Expand Down

0 comments on commit 375d85e

Please sign in to comment.