[elpa] 01/01: [gnugo] Make climb-to-root "GNU Go to play" reaction customizable.
ttn pushed a commit to branch master in repository elpa. commit d10f8dce5ed56734fc047701779f30ade168c58d Author: Thien-Thi Nguyen Date: Thu May 1 19:49:59 2014 +0200 [gnugo] Make climb-to-root "GNU Go to play" reaction customizable. * packages/gnugo/gnugo.el (gnugo-undo-reaction): New defvar. (gnugo--user-play): Inhibit karmic error for one-shot. (gnugo--climb-towards-root): Don't take 2nd arg NOALT; instead, take 2nd arg REACTION; drop "POS not occupied by COLOR" check and error; rewrite handling for "GNU Go to play" case. (gnugo-undo-one-move): Call ‘gnugo--climb-towards-root’ w/ ‘gnugo-undo-reaction’ value clamped to ‘zombie’/‘one-shot’. --- packages/gnugo/NEWS |1 + packages/gnugo/gnugo.el | 57 -- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/packages/gnugo/NEWS b/packages/gnugo/NEWS index 54a4cb2..026d67d 100644 --- a/packages/gnugo/NEWS +++ b/packages/gnugo/NEWS @@ -31,6 +31,7 @@ NB: "RCS: X..Y " means that the particular release includes - new command: ‘L’ (gnugo-frolic-in-the-leaves) - new command: ‘C-c C-a’ (gnugo-assist-mode) - new command: ‘C-c C-z’ (gnugo-zombie-mode) + - new var: gnugo-undo-reaction - new major mode: GNUGO Frolic (gnugo-frolic-mode) - GNUGO Board mode now derived from Special mode - position arg validated for direct GTP commands ‘undo’, ‘gg-undo’ diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el index 9f475dc..a01ae63 100644 --- a/packages/gnugo/gnugo.el +++ b/packages/gnugo/gnugo.el @@ -162,6 +162,19 @@ For ~t, the value is a snapshot, use `gnugo-refresh' to update it.") (defvar gnugo-grid-face 'default "Name of face to use for the grid (A B C ... 1 2 3 ...).") +(defvar gnugo-undo-reaction 'play! + "What to do if undo (or oops) leaves GNU Go to play. +After `gnugo-undo-one-move', `gnugo-undo-two-moves' or `gnugo-oops', +when GNU Go is to play, this can be a symbol: + play -- make GNU Go play (unless in Zombie mode) + play!-- make GNU Go play unconditionally (traditional behavior) + zombie -- enable Zombie mode (`gnugo-zombie-mode') + one-shot -- like `zombie' but valid only for the next move +Any other value, or (as a special case) for `gnugo-undo-one-move', +any value other than `zombie', is taken as `one-shot'. Note that +making GNU Go play will probably result in the recently-liberated +board position becoming re-occupied.") + ;;;--- ;;; Variables for the inquisitive programmer @@ -1747,8 +1760,10 @@ cursor to the suggested position. Prefix arg inhibits warp." (let ((color (gnugo-current-player))) ;; Don't get confused by mixed signals. (when (gnugo--karma color) - (user-error "Sorry, you cannot play for %s at this time" - color)) + (if (equal color (gnugo-get :one-shot)) + (gnugo--forget :one-shot) +(user-error "Sorry, you cannot play for %s at this time" +color))) (gnugo-push-move color pos-or-pass)) (gnugo--finish-move t)) @@ -2001,7 +2016,7 @@ If FILENAME already exists, Emacs confirms that you wish to overwrite it." return mem finally return nil -(defun gnugo--climb-towards-root (spec &optional noalt keep) +(defun gnugo--climb-towards-root (spec &optional reaction keep) (gnugo-gate) (gnugo--assist-state t) (let* ((user-color (gnugo-get :user-color)) @@ -2017,16 +2032,10 @@ If FILENAME already exists, Emacs confirms that you wish to overwrite it." 2) spec) (aref monkey 0)) - (let* ((pos (if (stringp spec) - spec - (gnugo-position))) -(hmm (gnugo--mem-with-played-stone pos))) - ;; todo: relax ‘gnugo--user-play’ then lift restriction - (unless (eq (gnugo--prop<-color user-color) - (car (gnugo--move-prop (car hmm - (user-error "%s not occupied by %s" - pos user-color)) - (cdr hmm) + (cdr (gnugo--mem-with-played-stone + (if (stringp spec) + spec + (gnugo-position))) (when (gnugo-get :game-over) (gnugo--unclose-game)) (while (and (not (eq stop (aref monkey 0))) @@ -2037,7 +2046,6 @@ If FILENAME already exists, Emacs confirms that you wish to overwrite it." (gnugo-refresh) ; this (redisplay)) ; eye candy (let* ((ulastp (string= (gnugo-get :last-mover) user-color)) - (ubpos (gnugo-move-history (if ulastp 'car 'cadr (gnugo-put :last-user-bpos (if (and ubpos (not (gnugo--passp ubpos)))
[elpa] branch master updated (fde4e61 -> d10f8dc)
ttn pushed a change to branch master in repository elpa. from fde4e61 [gnugo int] Move karma state normalization down-chain. new d10f8dc [gnugo] Make climb-to-root "GNU Go to play" reaction customizable. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: packages/gnugo/NEWS |1 + packages/gnugo/gnugo.el | 57 -- 2 files changed, 36 insertions(+), 22 deletions(-)
[elpa] branch master updated (d10f8dc -> cad5564)
epich pushed a change to branch master in repository elpa. from d10f8dc [gnugo] Make climb-to-root "GNU Go to play" reaction customizable. new cad5564 Fix bug that caused undo-tree to hang when undoing in region (bug#16377). The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: packages/undo-tree/undo-tree.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
[elpa] 01/01: Fix bug that caused undo-tree to hang when undoing in region (bug#16377).
epich pushed a commit to branch master in repository elpa. commit cad55641128d5396f6c49c3f3432f22e68a8de39 Author: Barry O'Reilly Date: Thu May 1 16:42:52 2014 -0400 Fix bug that caused undo-tree to hang when undoing in region (bug#16377). --- packages/undo-tree/undo-tree.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/undo-tree/undo-tree.el b/packages/undo-tree/undo-tree.el index 166c079..cb8a230 100644 --- a/packages/undo-tree/undo-tree.el +++ b/packages/undo-tree/undo-tree.el @@ -1690,13 +1690,13 @@ Comparison is done with `eq'." (defun undo-tree-copy-list (undo-list) ;; Return a deep copy of first changeset in `undo-list'. Object id's are ;; replaced by corresponding objects from `buffer-undo-tree' object-pool. - (when undo-list (let (copy p) ;; if first element contains an object id, replace it with object from ;; pool, discarding element entirely if it's been GC'd - (while (null copy) +(while (and undo-list (null copy)) (setq copy (undo-tree-restore-GC-elts-from-pool (pop undo-list +(when copy (setq copy (list copy) p copy) ;; copy remaining elements, replacing object id's with objects from
[elpa] branch master updated (cad5564 -> 8face87)
ttn pushed a change to branch master in repository elpa. from cad5564 Fix bug that caused undo-tree to hang when undoing in region (bug#16377). new 8face87 [gnugo] Make SGF I/O commands change ‘default-directory’. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: packages/gnugo/NEWS |1 + packages/gnugo/gnugo.el | 10 -- 2 files changed, 9 insertions(+), 2 deletions(-)
[elpa] 01/01: [gnugo] Make SGF I/O commands change ‘default-directory’.
ttn pushed a commit to branch master in repository elpa. commit 8face8768b05d793ece5d390d1e03157fe350375 Author: Thien-Thi Nguyen Date: Fri May 2 06:47:03 2014 +0200 [gnugo] Make SGF I/O commands change ‘default-directory’. * packages/gnugo/gnugo.el (gnugo--ok-file): New func. (gnugo-write-sgf-file, gnugo-read-sgf-file): Don't clear buffer-modified state; instead, call ‘gnugo--ok-file’. --- packages/gnugo/NEWS |1 + packages/gnugo/gnugo.el | 10 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/gnugo/NEWS b/packages/gnugo/NEWS index 026d67d..1650be8 100644 --- a/packages/gnugo/NEWS +++ b/packages/gnugo/NEWS @@ -36,6 +36,7 @@ NB: "RCS: X..Y " means that the particular release includes - GNUGO Board mode now derived from Special mode - position arg validated for direct GTP commands ‘undo’, ‘gg-undo’ - undo commands no longer signal error on overkill + - SGF I/O commands change ‘default-directory’ - performance improvements - of interest to hackers (see source, BI => backward incompatible) - dropped var: ‘gnugo-inhibit-refresh’ (BI) diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el index a01ae63..4a6d002 100644 --- a/packages/gnugo/gnugo.el +++ b/packages/gnugo/gnugo.el @@ -1897,6 +1897,12 @@ by how many stones)." (message "Est.score ... B %s %s | W %s %s | %s" black black-captures white white-captures est))) +(defun gnugo--ok-file (filename) + (setq default-directory +(file-name-directory + (expand-file-name filename))) + (set-buffer-modified-p nil)) + (defun gnugo-write-sgf-file (filename) "Save the game history to FILENAME (even if unfinished). If FILENAME already exists, Emacs confirms that you wish to overwrite it." @@ -1905,7 +1911,7 @@ If FILENAME already exists, Emacs confirms that you wish to overwrite it." (not (y-or-n-p "File exists. Continue? "))) (user-error "Not writing %s" filename)) (gnugo/sgf-write-file (gnugo-get :sgf-collection) filename) - (set-buffer-modified-p nil)) + (gnugo--ok-file filename)) (defun gnugo--dance-dance (karma) (destructuring-bind (dance btw) @@ -2000,7 +2006,7 @@ If FILENAME already exists, Emacs confirms that you wish to overwrite it." (gnugo-put :last-user-bpos (gnugo-move-history 'bpos (gnugo-get :user-color))) (gnugo-refresh t) -(set-buffer-modified-p nil) +(gnugo--ok-file filename) (gnugo--who-is-who wait play samep))) (defun gnugo--mem-with-played-stone (pos &optional noerror)
[elpa] 02/02: [gnugo int] Decruft: Presume ‘display-images-p’.
ttn pushed a commit to branch master in repository elpa. commit 2586cbad95c3b05fa8a5df0be1b01058a8cada3f Author: Thien-Thi Nguyen Date: Fri May 2 08:53:27 2014 +0200 [gnugo int] Decruft: Presume ‘display-images-p’. * packages/gnugo/gnugo.el (gnugo-toggle-image-display): Don't gate ‘display-images-p’ call w/ ‘fboundp’. --- packages/gnugo/gnugo.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el index 4a6d002..7e65915 100644 --- a/packages/gnugo/gnugo.el +++ b/packages/gnugo/gnugo.el @@ -498,7 +498,7 @@ when you are sure the command cannot fail." (t yang) (defun gnugo-toggle-image-display () - (unless (and (fboundp 'display-images-p) (display-images-p)) + (unless (display-images-p) (user-error "Display does not support images, sorry")) (require 'gnugo-xpms) (unless (and (boundp 'gnugo-xpms) gnugo-xpms)
[elpa] 01/02: [gnugo maint] Update HACKING; nfc.
ttn pushed a commit to branch master in repository elpa. commit 551d110a96698ed204cef55b5b9a629e782aa332 Author: Thien-Thi Nguyen Date: Fri May 2 08:52:58 2014 +0200 [gnugo maint] Update HACKING; nfc. --- packages/gnugo/HACKING |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/packages/gnugo/HACKING b/packages/gnugo/HACKING index 1d7bca8..2256bbe 100644 --- a/packages/gnugo/HACKING +++ b/packages/gnugo/HACKING @@ -14,8 +14,6 @@ This file is both a guide for newcomers and a todo list for oldstayers. * define simple API *** talk GTP over the network (?) pending [[wrap GTP ‘loadsgf’ completely]] -*** "assist minor mode" (see gnugo-extra.el for work in progress) -*** using assist minor mode, gnugo-v-gnugo (ibid) *** make gnugo (the external program) support query (read-only) thread *** extend GNUGO Board mode to manage another subprocess for analysis only *** command ‘C-u =’ to label a position
[elpa] branch master updated (8face87 -> 2586cba)
ttn pushed a change to branch master in repository elpa. from 8face87 [gnugo] Make SGF I/O commands change ‘default-directory’. new 551d110 [gnugo maint] Update HACKING; nfc. new 2586cba [gnugo int] Decruft: Presume ‘display-images-p’. The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: packages/gnugo/HACKING |2 -- packages/gnugo/gnugo.el |2 +- 2 files changed, 1 insertions(+), 3 deletions(-)