[gnugo] Make undo commands silently handle overkill.
It's impolite to reflect impoliteness. :-D
* packages/gnugo/gnugo.el (gnugo--climb-towards-root):
Don't use ‘gnugo--q/ue’ for GTP "undo"; instead,
use ‘gnugo--q’, detect overkill, and stop looping.
* packages/gnugo/gnugo.el (gnugo-move-history pretty):
Delete internal func.
(gnugo-move-history next): Revert to pre-‘pretty’ code.
(gnugo-move-history): For ‘bpos’ RSEL, convert search
condition from two negated string comparisons to one
"normal CC" position detection, and delay ‘as-pos’
call to rv computation.
[gnugo] On disable, transform in-flight user-move into suggestion.
* packages/gnugo/gnugo.el (gnugo-toggle-abdication):
Don't signal "too soon" error; instead, transform scheduled
user-move into a suggestion, include extra info in the
status message and sleep for 2 sec after message display;
update condition for ‘(gnugo-get-move gcolor)’ accordingly.
[gnugo] Allow user to request suggestion for GNU Go.
* packages/gnugo/gnugo.el (gnugo-get-move-insertion-filter):
Include color in suggestion message.
(gnugo-request-suggestion): Use ‘gnugo-current-player’.
[gnugo] Fix bug: DTRT for suggestion ‘nowarp’ check.
From inception 2014-04-15, "New
command: ‘S’ (gnugo-request-suggestion)".
* packages/gnugo/gnugo.el (gnugo-get-move-insertion-filter):
Don't feed ‘cons’ rv to ‘destructuring-bind’; instead,
drop var ‘pos-or-pass’, repurpose var ‘full’ -- surely
succumbing to Bad Style :-/, and access :waiting directly.
* packages/gnugo/gnugo.el (gnugo--climb-towards-root):
...into here if SPEC is neither number nor string.
(gnugo-oops, gnugo-fancy-undo): Update accordingly.
[gnugo int] Centralize some "No stone at POS" errors.
* packages/gnugo/gnugo.el (gnugo--mem-with-played-stone):
Take optional arg NOERROR; if clear, when no ‘color’
found, signal "No stone at POS" error.
(gnugo--climb-towards-root): Drop "POS already clear" error
handling; use ‘gnugo--mem-with-played-stone’ rv directly.
(gnugo--node-with-played-stone): Take optional arg NOERROR;
pass it to ‘gnugo--mem-with-played-stone’.
(gnugo-describe-position): Specify
NOERROR to ‘gnugo--node-with-played-stone’.
(gnugo-comment): Drop "No stone at POS" error handling;
use ‘gnugo--node-with-played-stone’ rv directly.
* packages/gnugo/gnugo.el (gnugo--climb-towards-root):
Don't construct local func ‘done’; instead, pre-compute
final MEM and loop until it's reached, as per ‘eq’.
[gnugo] On SGF load, leave cursor at last user board position.
* packages/gnugo/gnugo.el (gnugo-move-history):
Take optional second arg COLOR.
(gnugo-move-history remem): New internal func.
(gnugo-move-history pretty): New internal func.
(gnugo-move-history next): Use ‘remem’, ‘pretty’.
(gnugo-move-history): If RSEL is ‘bpos’, return
the position of the last stone placed by COLOR.
(gnugo-read-sgf-file): Set :last-user-bpos.
(gnugo): After refresh, prefer :last-user-bpos
to :center-position for cursor position.
[gnugo] Fix bug: Ensure gametree sync for -l/--infile.
Previously, specifying ‘--infile FILENAME’ (or ‘-l FILENAME’)
would result in a degenerate (root-node only) :sgf-gametree.
Incidentally, the "don't snoop" part of this change removes
the last remaining barrier to clean ‘lexical-binding: t’.
* packages/gnugo/gnugo.el (gnugo): Rewrite docstring;
parse user-specified command-line arguments;
don't snoop "--boardsize", "--handicap", "--komi";
instead, defer until subprocess available and then query;
rewrite kick args to segregate/prioritize "--infile", "-l";
save filename; when filename specified, expand it and
pass to ‘gnugo-read-sgf-file’ instead of constructing
the degenerate gametree; combine ‘gnugo--SZ!’ call with
aforementioned ‘board-size’, ‘handicap’, ‘komi’ mining
and do only for degenerate gametree construction.
[gnugo int] Couple :center-position and :SZ jamming.
* packages/gnugo/gnugo.el (gnugo--SZ!):
Convert to ‘defun’; also compute/assign :center-position.
(gnugo): Don't compute :center-position explicitly,
but do move point to it, after the refresh.
[gnugo int] Move some prop jamming to ‘gnugo-board-mode’.
* packages/gnugo/gnugo.el (gnugo-board-mode):
Move to here the setting of properties
:default-highlight-last-move-spec,
:highlight-last-move-spec, :paren-ov, :mul...
(gnugo): ...from here.
[gnugo] Decruft: Use ‘gnugo-program’ directly as executable.
* packages/gnugo/gnugo.el (gnugo-program): Rewrite docstring.
(gnugo): Add ‘gnugo-program’ sanity check prior to buffer
switch; drop support for "PROGRAM OPTIONS..." value.
From inception 2014-04-15, "New command:
‘C-c C-a’ (gnugo-toggle-abdication)".
* packages/gnugo/gnugo.el (gnugo-toggle-abdication):
Drop unused local var ‘ucolor’; also, don't bother
destructuring :waiting; instead, just check its truth value.
* packages/gnugo/gnugo.el (gnugo-toggle-image-display):
Save image factors in :imul instead of in :w-imul, :h-imul;
conditionally assign them directly to :mul instead of :wmul,
:hmul, or otherwise reset to ‘(1 . 1)’.
(gnugo-refresh): Update accordingly.
(gnugo): Init :mul to ‘(1 . 1)’.
* packages/gnugo/gnugo.el (gnugo-put): Update docstring.
(gnugo-refresh): Use ‘destructuring-bind’ for paren overlays.
(gnugo): Don't ‘gnugo-put’ overlays in :lparen-ov and
:rparen-ov; instead, cons them and stash the pair in :paren-ov.
* packages/gnugo/gnugo.el (gnugo): ...here,
in the root-node init, by checking for "user plays black"
directly, and inverting the resulting :PB, :PW values.
[gnugo] Move most of ‘gnugo-board-mode’ to ‘gnugo’.
Although the buffer-local hash ‘gnugo-state’ is available
in ‘gnugo-board-mode’, it is empty. This impacts mostly
funcs on ‘gnugo-board-mode-hook’ that use gnugo-{get,put}.
* packages/gnugo/gnugo.el (gnugo-board-mode):
Move buffer switching, options querying, process kicking,
a raft of ‘gnugo-put’ calls, and buffer refreshing from here...
(gnugo): ...to here; also, don't bother to ‘gnugo--forget’.
[gnugo] New command: ‘C-c C-a’ (gnugo-toggle-abdication)
* packages/gnugo/gnugo.el (gnugo-refresh):
Include "Abd" in mode line if abdication enabled.
(gnugo-get-move-insertion-filter): If abdication enabled,
create and save a timer object to call ‘gnugo-get-move’
w/ the opposite of the current ‘color’.
(gnugo-toggle-abdication): New command.
(gnugo-board-mode-map): Add binding for ‘C-c C-a’.
[gnugo int] Accept color for ‘gnugo-push-move’ 1st arg.
* packages/gnugo/gnugo.el (gnugo-push-move):
Rename first arg to WHO; if it is not a boolean, take it
as ‘color’ directly; update "effective userp" ref likewise.
(gnugo-get-move-insertion-filter):
Pass ‘color’ directly to ‘gnugo-push-move’.
[gnugo] New command: ‘S’ (gnugo-request-suggestion)
* packages/gnugo/gnugo.el (gnugo-gate):
If waiting for a suggestion, say "Still thinking"
instead of "Not your turn yet" in error message.
(gnugo--q): If waiting for a suggestion, say
"receive a suggestion" instead of "play" in error message.
(gnugo--rename-buffer-portion): New func.
(gnugo-get-move-insertion-filter): On received suggestion,
rename buffer w/ "to play", warp the cursor unless nonsensical
or inhibited, and display the suggestion in the echo area.
(gnugo-get-move): Take optional arg SUGGESTION;
save it as well as color in :waiting.
(gnugo-request-suggestion): New command.
(gnugo-board-mode-map): Add binding for ‘S’.
[gnugo] Make ‘C-u F’ add the blurb as a comment to the last node.
* packages/gnugo/gnugo.el (gnugo-display-final-score):
...here, if new prefix arg COMMENT is set, with "territory",
"captures", "komi" squashed to "T", "C", "K", respectively.
[gnugo int] Incorporate *-play-stone into ‘gnugo-push-move’.
U (X) ≡ "Don't call X".
* packages/gnugo/gnugo.el (gnugo--play-stone): Delete func.
(gnugo--user-play-stone): Delete defsubst.
(gnugo-push-move): Do GTP "play COLOR MOVE" here.
(gnugo-get-move-insertion-filter): U (gnugo--play-stone);
make USERP arg to ‘gnugo-push-move’ depend on :waiting color.
(gnugo-move, gnugo-pass): U (gnugo--user-play-stone).
(gnugo-okay): U (gnugo--play-stone); decruft local vars.
(gnugo-display-final-score): U (gnugo--play-stone).
[gnugo int] Rename :waitingp to :waiting; save color there.
* packages/gnugo/gnugo.el (gnugo-board-buffer-p)
(gnugo-get-move-insertion-filter, gnugo-display-final-score)
(gnugo-gate, gnugo--q, gnugo-refresh, gnugo-board-mode): Update.
(gnugo-get-move): Save COLOR in :waiting.