summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-09 00:09:42 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-09 00:09:42 +0000
commitdaa3d1cad1b0be5390bdd570d4c35b45bec13ccd (patch)
treecc8088ea7b2d8bc9040e373d8f5474198e55886e
parent244bfdc122b7427b3f3f96bef00415e579aff67d (diff)
*** no comment ***
-rw-r--r--TODO10
-rw-r--r--chess-display.el9
-rw-r--r--chess-ply.el9
3 files changed, 15 insertions, 13 deletions
diff --git a/TODO b/TODO
index 94f5234..c038b6d 100644
--- a/TODO
+++ b/TODO
@@ -54,18 +54,8 @@
- Let the user specify a default size for the chess-images display
-- chess-display-highlight should accept a list of positions and modes
- to highlight. Use keywords for the modes.
-
- allow dragging of pieces
-- add a shuffle chess position generator
-
-- add chess-ply-has-keyword, as a shorthand for using memq on the
- changes.
-
-- add chess-ply-move-source and chess-ply-move-target
-
----------------------------------------------------------------------
- Port image display code to XEmacs
diff --git a/chess-display.el b/chess-display.el
index 7c488d6..0d53548 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -261,15 +261,18 @@ If only START is given, it must be in algebraic move notation."
(setq chess-display-position (chess-ply-next-pos ply))))
(chess-display-update nil)))
-(defun chess-display-highlight (display index &optional mode)
+(defun chess-display-highlight (display &rest args)
"Highlight the square at INDEX on the current position.
The given highlighting MODE is used, or the default if the style you
are displaying with doesn't support that mode. `selected' is a mode
that is supported by most displays, and is the default mode."
(chess-with-current-buffer display
(if chess-display-highlight-function
- (funcall chess-display-highlight-function index
- (or mode 'selected)))))
+ (let ((mode :selected))
+ (dolist (arg args)
+ (if (symbolp arg)
+ (setq mode arg)
+ (funcall chess-display-highlight-function arg mode)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
diff --git a/chess-ply.el b/chess-ply.el
index 57c2451..adbeeed 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -62,6 +62,15 @@
(defsubst chess-ply-set-changes (ply changes)
(setcdr ply changes))
+(defsubst chess-ply-has-keyword (ply keyword)
+ (memq keyword (chess-ply-changes)))
+
+(defsubst chess-ply-source (ply)
+ (car (chess-ply-changes)))
+
+(defsubst chess-ply-target (ply)
+ (cadr (chess-ply-changes)))
+
(defsubst chess-ply-next-pos (ply)
(apply 'chess-pos-move (chess-pos-copy (chess-ply-pos ply))
(chess-ply-changes ply)))