[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 44/255: indentation
From: |
Eric Schulte |
Subject: |
[elpa] 44/255: indentation |
Date: |
Sun, 16 Mar 2014 01:02:15 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit dd68e3c104b9964ef51e25ce6dc3839002490b7d
Author: Eric Schulte <address@hidden>
Date: Fri May 18 15:06:25 2012 -0400
indentation
---
sgf.el | 71 ++++++++++++++++++++++++++++++++-------------------------------
1 files changed, 36 insertions(+), 35 deletions(-)
diff --git a/sgf.el b/sgf.el
index 55e67cd..c6be14d 100644
--- a/sgf.el
+++ b/sgf.el
@@ -199,14 +199,14 @@
(unless (listp raw) (error "sgf: can't process atomic sgf element."))
(if (listp (car raw))
(mapcar #'process raw)
- (let ((func (aget (car raw) sgf-property-alist)))
- (if func (cons (car raw) (funcall func (cdr raw))) raw))))
+ (let ((func (aget (car raw) sgf-property-alist)))
+ (if func (cons (car raw) (funcall func (cdr raw))) raw))))
(defun process-date (date-args)
(parse-time-string
(if (> 1 (length date-args))
(mapconcat #'number-to-string date-args " ")
- (car date-args))))
+ (car date-args))))
(add-to-list 'sgf-property-alist (cons "DT" #'process-date))
(defun process-board-size (size-args)
@@ -215,10 +215,10 @@
(defun char-to-pos (char)
(cond
- ((or (< char ?A) (< ?z char))
- (error "sgf: invalid char %s" char))
- ((< char ?a) (+ 26 (- char ?A)))
- (t (- char ?a))))
+ ((or (< char ?A) (< ?z char))
+ (error "sgf: invalid char %s" char))
+ ((< char ?a) (+ 26 (- char ?A)))
+ (t (- char ?a))))
(defun process-position (position-string)
(cons (char-to-pos (aref position-string 0))
@@ -235,7 +235,7 @@
(list
(cons :label (match-string 2 l-arg))
(cons :pos (process-position (match-string 1 l-arg))))
- (error "sgf: malformed label %S" l-arg)))
+ (error "sgf: malformed label %S" l-arg)))
label-args))
(add-to-list 'sgf-property-alist (cons "LB" #'process-label))
(add-to-list 'sgf-property-alist (cons "LW" #'process-label))
@@ -276,20 +276,21 @@
(defun board-pos-to-string (board pos)
(let ((size (board-size board)))
- (flet ((emph (n) (cond
- ((= size 19)
- (or (= 3 n)
- (= 4 (- size n))
- (= n (/ (- size 1) 2))))
- ((= size 9)
- (or (= 2 n)
- (= 4 n))))))
+ (flet ((emph (n)
+ (cond
+ ((= size 19)
+ (or (= 3 n)
+ (= 4 (- size n))
+ (= n (/ (- size 1) 2))))
+ ((= size 9)
+ (or (= 2 n)
+ (= 4 n))))))
(let ((val (aref board (pos-to-index pos size))))
(cond
- ((equal val :w) white-piece)
- ((equal val :b) black-piece)
- ((and (stringp val) (= 1 (length val)) val))
- (t (if (and (emph (car pos)) (emph (cdr pos))) "+" ".")))))))
+ ((equal val :w) white-piece)
+ ((equal val :b) black-piece)
+ ((and (stringp val) (= 1 (length val)) val))
+ (t (if (and (emph (car pos)) (emph (cdr pos))) "+" ".")))))))
(defun board-row-to-string (board row)
(let* ((size (board-size board))
@@ -345,7 +346,7 @@
"GO")))
(buffer (if (get-buffer name)
(error "sgf: buffer %s already exists" name)
- (get-buffer-create name)))
+ (get-buffer-create name)))
(size (aget "S" root)))
(unless size
(error "sgf: game has no associated size"))
@@ -405,28 +406,28 @@
(setf local-board (pieces-to-board
(aget :pieces (sgf-ref local-sgf
local-index))
(length local-board)))
- (clear-labels local-board)
- (apply-moves local-board (sgf-ref local-sgf local-index))
- (push (cons :pieces (board-to-pieces local-board))
- (sgf-ref local-sgf local-index))))
+ (clear-labels local-board)
+ (apply-moves local-board (sgf-ref local-sgf local-index))
+ (push (cons :pieces (board-to-pieces local-board))
+ (sgf-ref local-sgf local-index))))
(update-display)))
;;; Board manipulation functions
(defun move-type (move)
(cond
- ((member (car move) '("B" "W")) :move)
- ((member (car move) '("LB" "LW")) :label)))
+ ((member (car move) '("B" "W")) :move)
+ ((member (car move) '("LB" "LW")) :label)))
(defun apply-moves (board moves)
(flet ((bset (val data)
- (setf (aref board (pos-to-index (aget :pos data)
- (board-size board)))
- (cond ((string= "B" val) :b)
- ((string= "W" val) :w)
- ((string= "LB" val) (aget :label data))
- ((string= "LW" val) (aget :label data))
- (t nil)))))
+ (setf (aref board (pos-to-index (aget :pos data)
+ (board-size board)))
+ (cond ((string= "B" val) :b)
+ ((string= "W" val) :w)
+ ((string= "LB" val) (aget :label data))
+ ((string= "LW" val) (aget :label data))
+ (t nil)))))
(dolist (move moves board)
(case (move-type move)
(:move
@@ -488,7 +489,7 @@
(define-key map (kbd "<right>") 'right)
(define-key map (kbd "<left>") 'left)
(define-key map (kbd "q") (lambda () (interactive)
- (kill-buffer (current-buffer))))
+ (kill-buffer (current-buffer))))
map)
"Keymap for `sgf-mode'.")
- [elpa] 18/255: applying moves to a board, (continued)
- [elpa] 18/255: applying moves to a board, Eric Schulte, 2014/03/15
- [elpa] 37/255: remove debug printf, Eric Schulte, 2014/03/15
- [elpa] 34/255: beginning to stub out tests for dead stone removal, Eric Schulte, 2014/03/15
- [elpa] 38/255: more capture tests, failing multistone captures, Eric Schulte, 2014/03/15
- [elpa] 36/255: passing all tests (at least it did this once), Eric Schulte, 2014/03/15
- [elpa] 26/255: improvements, considering labels and moves, Eric Schulte, 2014/03/15
- [elpa] 40/255: parsing empty properties, Eric Schulte, 2014/03/15
- [elpa] 42/255: more work with tree parsing, Eric Schulte, 2014/03/15
- [elpa] 46/255: TODO: try using load-read-function and try loading these files w/read, Eric Schulte, 2014/03/15
- [elpa] 45/255: looking at a new method of parsing trees, Eric Schulte, 2014/03/15
- [elpa] 44/255: indentation,
Eric Schulte <=
- [elpa] 43/255: paren matching, Eric Schulte, 2014/03/15
- [elpa] 49/255: removed debug stuffs, Eric Schulte, 2014/03/15
- [elpa] 47/255: parsing of sgf files with alternative paths working, Eric Schulte, 2014/03/15
- [elpa] 48/255: all tests are passing, Eric Schulte, 2014/03/15
- [elpa] 52/255: more condensed collecting of games w/alternatives, Eric Schulte, 2014/03/15
- [elpa] 51/255: parsing large complex files, Eric Schulte, 2014/03/15
- [elpa] 39/255: passing all tests, Eric Schulte, 2014/03/15
- [elpa] 50/255: whitespace, Eric Schulte, 2014/03/15
- [elpa] 41/255: simplified parse-tree, but not done, Eric Schulte, 2014/03/15
- [elpa] 53/255: passing all tests, Eric Schulte, 2014/03/15