diff options
| author | dickmao <dick.r.chiang@gmail.com> | 2018-08-27 17:00:35 -0400 |
|---|---|---|
| committer | dickmao <dick.r.chiang@gmail.com> | 2018-09-06 09:24:10 -0400 |
| commit | 3222b53d942daa404852e5148ba9d3ebb8fe96d0 (patch) | |
| tree | 37e2af6242423e57adbbc1238433f58c92ac9bd0 /chess-game.el | |
| parent | 67339d896aa65d75272b80134a8128276c8c6a0f (diff) | |
Pre-moves
To activate, look for Chess Display Allow Pre Moves in:
M-x customize-group
chess-display
Tested via:
make test
make test24 (requires evim)
Diffstat (limited to 'chess-game.el')
| -rw-r--r-- | chess-game.el | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/chess-game.el b/chess-game.el index ed38288..8b72035 100644 --- a/chess-game.el +++ b/chess-game.el @@ -75,13 +75,19 @@ matches." (if (and (eq (caar h) function) (or (null data) (eq data (cdar h)))) - (if last-hook - (setcdr last-hook (cdr h)) - (setq hooks (cdr h))) + (if last-hook + (setcdr last-hook (cdr h)) + (setq hooks (cdr h))) (setq last-hook h)) (setq h (cdr h))) (chess-game-set-hooks game hooks))) +(defun chess-game-get-hook-data (game function) + "Get list of corresponding data (nil if none) from all event hooks that match FUNCTION." + (cl-assert game) + (cl-assert function) + (cl-remove-if 'null (mapcar (lambda (h) (if (eq (car h) function) (cdr h))) (chess-game-hooks game)))) + (defsubst chess-game-run-hooks (game &rest args) "Run the event hooks of GAME and pass ARGS." (cl-assert game) @@ -337,7 +343,8 @@ progress (nil), if it is drawn, resigned, mate, etc." (if (chess-ply-keyword ply :resign) (chess-game-run-hooks game 'resign) - (chess-game-run-hooks game 'move current-ply)))) + (chess-game-run-hooks game 'move current-ply) + (chess-game-run-hooks game 'pre-move)))) (defsubst chess-game-end (game keyword) "End GAME, by resignation, draw, etc." |
