From 3222b53d942daa404852e5148ba9d3ebb8fe96d0 Mon Sep 17 00:00:00 2001 From: dickmao Date: Mon, 27 Aug 2018 17:00:35 -0400 Subject: 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) --- chess-ics.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'chess-ics.el') diff --git a/chess-ics.el b/chess-ics.el index 51ce1e0..9cc5c99 100644 --- a/chess-ics.el +++ b/chess-ics.el @@ -376,7 +376,7 @@ standard position). In those cases, this variable should be set to nil.") (lambda () (funcall #'chess-engine-default-handler 'undo (string-to-number (match-string 1)))))) - (cons "The game has been aborted on move [^.]+\\." + (cons "\\S-+ has aborted the game on move [^.]+\\." (function (lambda () (let ((chess-engine-pending-offer 'abort)) @@ -386,7 +386,7 @@ standard position). In those cases, this variable should be set to nil.") (lambda () (funcall #'chess-engine-default-handler 'accept)))) (cons ;; resign announcement - "{Game \\([0-9]+\\) (\\(\\S-+\\) vs\\. \\(\\S-+\\)) \\(\\S-+\\) resigns}" + "{Game \\([0-9]+\\) (\\(\\S-+\\) vs\\. \\(\\S-+\\)) \\(\\S-+\\) \\(resigns\\|forfeits by disconnection\\)}" (function (lambda () (let ((chess-engine-handling-event t) @@ -403,9 +403,10 @@ standard position). In those cases, this variable should be set to nil.") (cons "\\(\\S-+\\) forfeits on time}" (function (lambda () - (if (string= (match-string 1) chess-engine-opponent-name) - (funcall #'chess-engine-default-handler 'flag-fell) - (funcall #'chess-engine-default-handler 'call-flag t))))) + (let ((opponent-p (not (string= chess-ics-handle (match-string 1))))) + (if opponent-p + (funcall #'chess-engine-default-handler 'flag-fell) + (funcall #'chess-engine-default-handler 'call-flag t)))))) (cons "Illegal move (\\([^)]+\\))\\." (function (lambda () -- cgit v1.2.3