ttn pushed a commit to branch master in repository elpa. commit d0d5b932dde96dc1309dbc15c061e052dc752ceb Author: Thien-Thi Nguyen <t...@gnu.org> Date: Fri May 2 10:40:42 2014 +0200
[gnugo] Make ‘gnugo-xpms’ a normal var; drop it as feature. * packages/gnugo/gnugo.el (gnugo-xpms): Move earlier in file, to "uninquisitive programmer" section; remove ‘eval-when-compile’ wrap; add docstring. (gnugo-toggle-image-display): Don't ‘(require 'gnugo-xmps)’; don't gate ‘gnugo-xpms’ access w/ ‘boundp’. --- packages/gnugo/HACKING | 2 +- packages/gnugo/NEWS | 1 + packages/gnugo/gnugo.el | 30 +++++++++++++++++++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/packages/gnugo/HACKING b/packages/gnugo/HACKING index 2256bbe..cad3cc8 100644 --- a/packages/gnugo/HACKING +++ b/packages/gnugo/HACKING @@ -10,7 +10,7 @@ This file is both a guide for newcomers and a todo list for oldstayers. * ideas / wishlist *** wrap GTP ‘loadsgf’ completely *** revamp image support -***** zonk ‘require’ +***** DONE zonk ‘require’ ***** define simple API *** talk GTP over the network (?) pending [[wrap GTP ‘loadsgf’ completely]] diff --git a/packages/gnugo/NEWS b/packages/gnugo/NEWS index 1650be8..1f48fdd 100644 --- a/packages/gnugo/NEWS +++ b/packages/gnugo/NEWS @@ -18,6 +18,7 @@ NB: "RCS: X..Y " means that the particular release includes - proper support for ‘-l FILENAME’ / ‘--infile FILENAME’ - dropped support for ‘gnugo-program’ of form "PROGRAM OPTIONS..." - dropped command: ‘t’ (gnugo-toggle-dead-group) + - ‘gnugo-xpms’ now a normal var, and not a feature - PASS for SZ <= 19 normalized to "" on read, written as "" - ‘=’ also displays move number of the stone (if any) at that position - ‘C-u F’ adds the (abbreviated) blurb as a comment to the last node diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el index 837c360..614d0ed 100644 --- a/packages/gnugo/gnugo.el +++ b/packages/gnugo/gnugo.el @@ -176,6 +176,26 @@ 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.") +(defvar gnugo-xpms nil + "List of 46 ((TYPE . LOCATION) . XPM-IMAGE) forms. +XPM-IMAGE is an image as returned by `create-image' with +inline data (i.e., property :data with string value). + +TYPE is a symbol, one of: + hoshi -- unoccupied position with dot + empty -- unoccupied position sans dot + bpmoku, bmoku -- black stone with and sans highlight point + wpmoku, wmoku -- white stone with and sans highlight point + +LOCATION is an integer encoding edge, corner, or center: + 1 2 3 + 4 5 6 + 7 8 9 +For instance, 4 means \"left edge\", 9 means \"bottom right\". + +There is only one location for hoshi: center. The other five +types each have all possible locations. So (+ 1 (* 9 5)) => 46.") + ;;;--------------------------------------------------------------------------- ;;; Variables for the inquisitive programmer @@ -188,9 +208,6 @@ board position becoming re-occupied.") (defvar gnugo-state nil) ; hint: C-c C-p -(eval-when-compile - (defvar gnugo-xpms nil)) - (defvar gnugo-frolic-parent-buffer nil) (defvar gnugo-frolic-origin nil) @@ -501,10 +518,9 @@ when you are sure the command cannot fail." (defun gnugo-toggle-image-display () (unless (display-images-p) (user-error "Display does not support images, sorry")) - (require 'gnugo-xpms) - (unless (and (boundp 'gnugo-xpms) gnugo-xpms) - (user-error "Could not load `gnugo-xpms', sorry")) - (let ((fresh (or (gnugo-get :local-xpms) gnugo-xpms))) + (let ((fresh (or (gnugo-get :local-xpms) + gnugo-xpms + (user-error "Sorry, `gnugo-xpms' unset")))) (unless (eq fresh (gnugo-get :xpms)) (gnugo-put :xpms fresh) (gnugo--forget :all-yy)))