[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 02/02: [gnugo] Conditionalize xform warping on abdication disable
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 02/02: [gnugo] Conditionalize xform warping on abdication disable. |
Date: |
Fri, 25 Apr 2014 13:04:32 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit 6d01345f49948e806240c780a91d66ce3df4c15e
Author: Thien-Thi Nguyen <address@hidden>
Date: Fri Apr 25 15:02:36 2014 +0200
[gnugo] Conditionalize xform warping on abdication disable.
* packages/gnugo/gnugo.el (gnugo-toggle-abdication):
For xform, don't specify ‘nowarp’ unconditionally; instead,
if user appears to be "following along", specify ‘t’;
move xform path completely inside disable path.
---
packages/gnugo/gnugo.el | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index b54ce2b..81c4361 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -2303,29 +2303,34 @@ a move to play for you, the thinking is not cancelled
but instead
transformed into a move suggestion (see `gnugo-request-suggestion')."
(interactive)
(let ((last-mover (gnugo-get :last-mover))
- (abd (gnugo-get :abd))
- xform)
+ (abd (gnugo-get :abd)))
(if abd
;; disable
(let* ((gcolor (gnugo-get :gnugo-color))
(waiting (gnugo-get :waiting))
(userp (string= last-mover gcolor)))
- (when (and userp waiting)
- (gnugo--rename-buffer-portion)
- (setcdr waiting (setq xform 'nowarp)))
(when (timerp abd)
(cancel-timer abd))
(gnugo--forget :abd)
+ (when (and userp waiting)
+ (let ((u (gnugo-get :user-color)))
+ (gnugo--rename-buffer-portion)
+ (setcdr waiting
+ ;; heuristic: Warp only if it appears
+ ;; that the user is "following along".
+ (or (ignore-errors
+ (string= (gnugo-position)
+ (gnugo-move-history 'bpos u)))
+ 'nowarp))
+ (gnugo--display-suggestion u "forthcoming")
+ (sleep-for 2)))
(unless (or userp waiting)
(gnugo-get-move gcolor)))
;; enable
(gnugo-gate t)
(gnugo-put :abd t)
(gnugo-get-move (gnugo-other last-mover)))
- (force-mode-line-update) ; hmm
- (when xform
- (gnugo--display-suggestion (gnugo-get :user-color) "forthcoming")
- (sleep-for 2))))
+ (force-mode-line-update)))
;;;---------------------------------------------------------------------------
;;; Command properties and gnugo-command