[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo a44da1b 073/357: [gnugo sgf int] Add abstractions
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo a44da1b 073/357: [gnugo sgf int] Add abstractions: >>prop, >>node, >>tree |
Date: |
Sun, 29 Nov 2020 14:50:52 -0500 (EST) |
branch: externals/gnugo
commit a44da1bf8bb827d302ee10cbe3fc54c67771ce7c
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo sgf int] Add abstractions: >>prop, >>node, >>tree
* packages/gnugo/gnugo.el (gnugo/sgf-write-file):
...here, as internal funcs via ‘cl-labels’.
---
gnugo.el | 57 +++++++++++++++++++++++++++++++++------------------------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index 7b8b829..af71c59 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -2191,32 +2191,41 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
((< 60 (current-column))
(save-excursion
(goto-char p)
- (insert "\n"))))))
+ (insert "\n")))))
+ (>>prop (prop)
+ (setq p (point)
+ name (car prop)
+ v (cdr prop))
+ (insert (substring (symbol-name name) 1))
+ (cond ((not v))
+ ((and (consp v)
+ (setq spec (cdr (assq name specs)))
+ (memq (car spec)
+ '(list elist)))
+ (>>nl)
+ (let ((>> (if (consp (cadr spec))
+ #'>>two
+ #'>>one)))
+ (dolist (little-v v)
+ (setq p (point))
+ (funcall >> little-v)
+ (>>nl))))
+ ((consp v)
+ (>>two v) (>>nl))
+ (t
+ (>>one v) (>>nl))))
+ (>>node (node)
+ (loop initially (insert ";")
+ for prop in node
+ do (>>prop prop)))
+ (>>tree (tree)
+ (insert "(")
+ (dolist (node tree)
+ (>>node node))
+ (insert ")\n")))
(with-temp-buffer
(dolist (tree collection)
- (insert "(")
- (dolist (node tree)
- (insert ";")
- (dolist (prop node)
- (setq p (point)
- name (car prop)
- v (cdr prop))
- (insert (substring (symbol-name name) 1))
- (cond ((not v))
- ((and (consp v)
- (memq (car (setq spec (cdr (assq name specs))))
- '(list elist)))
- (>>nl)
- (let ((>> (if (consp (cadr spec))
- #'>>two
- #'>>one)))
- (dolist (little-v v)
- (setq p (point)) (funcall >> little-v) (>>nl))))
- ((consp v)
- (>>two v) (>>nl))
- (t
- (>>one v) (>>nl)))))
- (insert ")\n"))
+ (>>tree tree))
(write-file filename)))))
;;; gnugo.el ends here
- [elpa] externals/gnugo a949e26 071/357: [gnugo int] Rename arg from SWITCH to ME-NEXT., (continued)
- [elpa] externals/gnugo a949e26 071/357: [gnugo int] Rename arg from SWITCH to ME-NEXT., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 558d778 072/357: [gnugo] Fix bug: Handle property value type ‘none’ normally., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 9469952 075/357: fixup! [gnugo sgf] Move gratuitous newline from after to before (sub)trees., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 4f96ca6 076/357: [gnugo sgf int] Add abstractions: seek, seek-into, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 98414ca 086/357: [gnugo int] Add abstractions: gnugo{--root-node, /sgf-root-node}, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 622b1eb 084/357: [gnugo] Handle ‘(gnugo-move-history 'two)’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 06586e9 093/357: [gnugo] Fix bug: Don't bother translating move "resign"., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7f380e4 006/357: [gnugo] Presume working time-date.el., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 74b839a 066/357: [gnugo int] Use ‘incf’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo ad774f4 074/357: [gnugo sgf] Move gratuitous newline from after to before (sub)trees., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a44da1b 073/357: [gnugo sgf int] Add abstractions: >>prop, >>node, >>tree,
Stefan Monnier <=
- [elpa] externals/gnugo a7f01be 083/357: [gnugo int] Add abstraction: nn, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a07cf7c 109/357: [gnugo int] Use ‘gnugo--as-pos-func’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 71f163d 111/357: [gnugo int] Support growth also off of main line., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0b08017 114/357: [gnugo int] Avoid double list-reverse., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 08c3378 116/357: [gnugo int] Use ‘gnugo/sgf-create’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 44c2dc4 118/357: [gnugo int] Make ‘gnugo--no-regrets’ take ENDS directly., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7705eca 126/357: [gnugo int] Drop :monkey COUNT; use node's tree MNUM directly., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 4b24b56 142/357: [gnugo frolic int] Don't go through ‘gnugo-frolic-quit’ for refresh., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo dfc130d 136/357: [gnugo frolic] Add backward/forward branch navigation commands., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e75eb8a 135/357: [gnugo frolic] Add some branch swizzling commands., Stefan Monnier, 2020/11/29