summaryrefslogtreecommitdiff
path: root/chess-pgn.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-05-16 17:35:09 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-05-16 17:35:09 +0000
commitdbd2eed2881736ea2349e5bd590e40a8ad0b87f3 (patch)
treea0cd3bb7e0a927f331a786157716dbbd8f483f52 /chess-pgn.el
parent59d1008283f339d6c6d146979c4cff0c6430b095 (diff)
Removed dependency on cl's `position' function.
Diffstat (limited to 'chess-pgn.el')
-rw-r--r--chess-pgn.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/chess-pgn.el b/chess-pgn.el
index c720ecf..ca52e46 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -134,6 +134,16 @@ If INDENTED is non-nil, indent the move texts."
(buffer-string))
(chess-insert-pgn game indented)))
+(defun chess-member-index (tag)
+ (let ((index 0)
+ (tags chess-pgn-tag-order))
+ (while tags
+ (if (equal tag (car tags))
+ (setq tags nil)
+ (setq index (1+ index)
+ tags (cdr tags))))
+ index))
+
(defun chess-insert-pgn (game &optional indented)
(let ((fen (chess-game-tag game "FEN"))
(first-pos (chess-game-pos game 0)))
@@ -147,10 +157,8 @@ If INDENTED is non-nil, indent the move texts."
(function
(lambda (left right)
(setq left (car left) right (car right))
- (let ((l-idx (position left chess-pgn-tag-order
- :test 'equal))
- (r-idx (position right chess-pgn-tag-order
- :test 'equal)))
+ (let ((l-idx (chess-member-index left))
+ (r-idx (chess-member-index right)))
(cond
((and l-idx (not r-idx)) t)
((and (not l-idx) r-idx) nil)