[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 25/255: right and left are mainly working
From: |
Eric Schulte |
Subject: |
[elpa] 25/255: right and left are mainly working |
Date: |
Sun, 16 Mar 2014 01:02:12 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit 89bc0464bb0f535523d12530fbd38e105fdf28b0
Author: Eric Schulte <address@hidden>
Date: Tue May 15 21:16:53 2012 -0400
right and left are mainly working
---
sgf.el | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/sgf.el b/sgf.el
index 8fc0d79..a615e28 100644
--- a/sgf.el
+++ b/sgf.el
@@ -266,18 +266,19 @@
(mapconcat #'identity (list header body header) "\n")))
(defun update-display ()
+ (unless *sgf* (error "sgf: buffer has not associated sgf data"))
(delete-region (point-min) (point-max))
(goto-char (point-min))
(insert
"\n"
(board-to-string *board*)
"\n\n")
- (let ((comment (cdr (assoc "C" (sgf-ref *sgf* *index*)))))
+ (let ((comment (second (assoc "C" (sgf-ref *sgf* *index*)))))
(when comment
(insert (make-string (+ 6 (* 2 (board-size *board*))) ?=)
"\n\n")
(let ((beg (point)))
- (insert *comment*)
+ (insert comment)
(fill-region beg (point)))))
(goto-char (point-min)))
@@ -289,9 +290,9 @@
"GO")))
(buffer (get-buffer-create name)))
(with-current-buffer buffer
- (setf *sgf* game)
- (setf *board* (make-board (cdr (assoc "S" root))))
- (setf *index* '(1))
+ (setq *sgf* game)
+ (setq *board* (make-board (cdr (assoc "S" root))))
+ (setq *index* '(0))
(update-display))
(pop-to-buffer buffer)))
@@ -309,11 +310,11 @@
(defun left (&optional num)
(interactive "p")
(prog1 (dotimes (n num n)
- (decf (car (last *index*)))
(unless (sgf-ref *sgf* *index*)
(update-display)
(error "sgf: no more backwards moves."))
- (revert-moves *board* (sgf-ref *sgf* *index*)))
+ (revert-moves *board* (sgf-ref *sgf* *index*))
+ (decf (car (last *index*))))
(update-display)))
(defun right (&optional num)
@@ -321,6 +322,7 @@
(prog1 (dotimes (n num n)
(incf (car (last *index*)))
(unless (sgf-ref *sgf* *index*)
+ (decf (car (last *index*)))
(update-display)
(error "sgf: no more forward moves."))
(apply-moves *board* (sgf-ref *sgf* *index*)))
- [elpa] 22/255: example sgf file generated using gcoban, (continued)
- [elpa] 22/255: example sgf file generated using gcoban, Eric Schulte, 2014/03/15
- [elpa] 17/255: not using "I" as an index, Eric Schulte, 2014/03/15
- [elpa] 20/255: alright "i" *is* a valid position identifier, Eric Schulte, 2014/03/15
- [elpa] 16/255: cleaned up board printing, Eric Schulte, 2014/03/15
- [elpa] 09/255: parsing more complex trees, Eric Schulte, 2014/03/15
- [elpa] 19/255: moving games/ -> sgf-files/, Eric Schulte, 2014/03/15
- [elpa] 10/255: helper functions, Eric Schulte, 2014/03/15
- [elpa] 24/255: right and left implemented but buggy, Eric Schulte, 2014/03/15
- [elpa] 23/255: more complex but more intuitive and useful `range', Eric Schulte, 2014/03/15
- [elpa] 21/255: display sgf file as a go board in a buffer, Eric Schulte, 2014/03/15
- [elpa] 25/255: right and left are mainly working,
Eric Schulte <=
- [elpa] 29/255: q now quits a sgf display buffer, Eric Schulte, 2014/03/15
- [elpa] 28/255: adding a major mode for board navigation keys, Eric Schulte, 2014/03/15
- [elpa] 27/255: implementation notes, Eric Schulte, 2014/03/15
- [elpa] 31/255: a test to protect against unwanted state changes, Eric Schulte, 2014/03/15
- [elpa] 33/255: removing dead pieces after moves, Eric Schulte, 2014/03/15
- [elpa] 35/255: compiled and caught some minor issues, Eric Schulte, 2014/03/15
- [elpa] 32/255: consolidating utility functions, Eric Schulte, 2014/03/15
- [elpa] 30/255: saving the board configuration with each sgf step, Eric Schulte, 2014/03/15
- [elpa] 18/255: applying moves to a board, Eric Schulte, 2014/03/15
- [elpa] 37/255: remove debug printf, Eric Schulte, 2014/03/15