[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 03/04: [gnugo] Handle function for ‘gnugo-xpms’ value.
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 03/04: [gnugo] Handle function for ‘gnugo-xpms’ value. |
Date: |
Fri, 02 May 2014 09:27:26 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit 5a8d8158da67b90e0d5ad0c2a837b873a728bfd9
Author: Thien-Thi Nguyen <address@hidden>
Date: Fri May 2 11:23:29 2014 +0200
[gnugo] Handle function for ‘gnugo-xpms’ value.
* packages/gnugo/gnugo.el (gnugo-xpms): Update docstring.
(gnugo-toggle-image-display): If ‘gnugo-xpms’
is a function, call it with the board size and
take its rv as the set of XPM images to use.
---
packages/gnugo/NEWS | 4 +++-
packages/gnugo/gnugo.el | 15 +++++++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/packages/gnugo/NEWS b/packages/gnugo/NEWS
index 1f48fdd..b873710 100644
--- a/packages/gnugo/NEWS
+++ b/packages/gnugo/NEWS
@@ -18,7 +18,9 @@ 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
+ - changes to ‘gnugo-xpms’
+ - now a normal var, and not a feature
+ - value can be a function to compute XPMs
- 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 614d0ed..61ef95f 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -194,7 +194,11 @@ LOCATION is an integer encoding edge, corner, or center:
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.")
+types each have all possible locations. So (+ 1 (* 9 5)) => 46.
+
+The value can also be a function (satisfying `functionp') that
+takes one arg, the size of the board, and returns the appropriate
+list of forms.")
;;;---------------------------------------------------------------------------
;;; Variables for the inquisitive programmer
@@ -518,9 +522,12 @@ 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"))
- (let ((fresh (or (gnugo-get :local-xpms)
- gnugo-xpms
- (user-error "Sorry, `gnugo-xpms' unset"))))
+ (let ((fresh (or (gnguo-get :local-xpms)
+ (if (functionp gnugo-xpms)
+ (funcall gnugo-xpms (gnugo-get :SZ))
+ gnugo-xpms))))
+ (unless fresh
+ (user-error "Sorry, `gnugo-xpms' unset"))
(unless (eq fresh (gnugo-get :xpms))
(gnugo-put :xpms fresh)
(gnugo--forget :all-yy)))