[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo fce1fb0 077/357: [gnugo sgf] Fix bug: Output subt
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo fce1fb0 077/357: [gnugo sgf] Fix bug: Output subtrees correctly. |
Date: |
Sun, 29 Nov 2020 14:50:53 -0500 (EST) |
branch: externals/gnugo
commit fce1fb0bb6f7f9230c250349e11b1484b2aa0812
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo sgf] Fix bug: Output subtrees correctly.
Long-standing -- from inception -- omission.
* packages/gnugo/gnugo.el (gnugo/sgf-write-file >>tree):
Don't assume all elements of a tree are nodes; instead,
handle nodes as before, and recurse on trailing subtree elems.
---
NEWS | 1 +
gnugo.el | 18 ++++++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index fbfec3b..7ca102b 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Hint: (highlight-phrase
"[0-9][.][0-9][.][0-9]+\\|[0-9]+[.][.][0-9]+"
- next | NOT YET RELEASED
- bugfixes
- don't special-case property value type ‘none’
+ - handle subtrees on write
- new keybinding for ‘gnugo-undo-one-move’: M-u
- ‘gnugo-undo-one-move’ can optionally switch colors
- performance improvements
diff --git a/gnugo.el b/gnugo.el
index 02fe4e3..39531e9 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -2155,6 +2155,7 @@ starting a new one. See `gnugo-board-mode' documentation
for more info."
;; hmm
;; ‘append’ => ([NODE...] [SUBTREE...])
;; ‘cons’ => (([NODE...]) . [SUBTREE...])
+ ;; see consequent hair in -write-file
(append
;; nodes
(loop while (seek ?\;)
@@ -2224,8 +2225,21 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
(unless (zerop (current-column))
(newline))
(insert "(")
- (dolist (node tree)
- (>>node node))
+ ;; The IR (see "hmm" above) prioritizes space
+ ;; efficiency; no cost if no subtrees (common case).
+ ;; The downside, however, is that subtree access
+ ;; requires this somewhat-funky border search.
+ (let (x subtrees)
+ (while (setq x (pop tree))
+ (if (symbolp (caar x))
+ (>>node x)
+ (setq
+ ;; Add back the first subtree.
+ subtrees (cons x tree)
+ ;; Arrange to stop searching.
+ tree nil)))
+ (dolist (sub subtrees)
+ (>>tree sub)))
(insert ")")))
(with-temp-buffer
(dolist (tree collection)
- [elpa] externals/gnugo 35571e3 287/357: [gnugo int] Use private obarray for :all-yy elems, display props., (continued)
- [elpa] externals/gnugo 35571e3 287/357: [gnugo int] Use private obarray for :all-yy elems, display props., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0473d72 264/357: [gnugo int] Comment munging; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5b49aad 316/357: [gnugo int] Use ‘line-end-position’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7544ffe 311/357: [gnugo maint] Add copyright policy to HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1ff7a11 307/357: [gnugo maint] Add ‘URL’ header; trim Hacking URL; drop Tip Jar URL., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 10d29a9 301/357: [gnugo] Only set AP for modified gametrees in the collection., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo da98bc8 288/357: [gnugo int] Replace COND expression w/ IF., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 26c849f 330/357: [gnugo int] Decruft: Don't declare hook and keymap vars., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b5b3fd6 337/357: [gnugo int] Reduce ‘setq’ usage., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo c885c9c 020/357: [gnugo int] Avoid variable FORMAT for ‘message’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo fce1fb0 077/357: [gnugo sgf] Fix bug: Output subtrees correctly.,
Stefan Monnier <=
- [elpa] externals/gnugo 5ca7efb 099/357: [gnugo int] Remove redundant game-over condition check., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7fee3b2 104/357: [gnugo] Move "1 or 2" calculation into ‘gnugo-magic-undo’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a86327a 108/357: [gnugo] Add command ‘gnugo-frolic-in-the-leaves’ and keybinding., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f5fbba3 153/357: [gnugo int] Fix bug: Update local var ‘ends’ when branching., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a4dcef8 150/357: [gnugo frolic int] Parameterize, centralize awakening., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1b69add 160/357: [gnugo int] Decruft: Drop gametree IR element: KIDS, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 891a97a 177/357: [gnugo int] Add abstraction: gnugo--decorate, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 843cd96 163/357: [gnugo frolic int] Add abstraction: gnugo--sideways, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo eb13b8e 180/357: [gnugo] Dropped command: ‘t’ (gnugo-toggle-dead-group), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 6c7e102 181/357: [gnugo int] Rename :waitingp to :waiting; save color there., Stefan Monnier, 2020/11/29