[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 7025924 156/357: [gnugo sgf] Fix bug: Add ‘\’-es
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 7025924 156/357: [gnugo sgf] Fix bug: Add ‘\’-escapes on write. |
Date: |
Sun, 29 Nov 2020 14:51:11 -0500 (EST) |
branch: externals/gnugo
commit 70259248fc5c929a426c295245acae949c23a9d6
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo sgf] Fix bug: Add ‘\’-escapes on write.
* packages/gnugo/gnugo.el (gnugo/sgf-write-file esc):
New internal func.
(gnugo/sgf-write-file >>one)
(gnugo/sgf-write-file >>two): Use ‘esc’.
---
NEWS | 1 +
gnugo.el | 19 ++++++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 8bd3b75..f0148f6 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ NB: "RCS: X..Y " means that the particular release includes
- next | NOT YET RELEASED
- bugfixes
+ - on write, use ‘\’ to escape certain chars
- preserve whitespace for value type ‘text’
- don't special-case property value type ‘none’
- handle subtrees on write
diff --git a/gnugo.el b/gnugo.el
index 66af605..2009034 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -2774,10 +2774,23 @@ A collection is a list of gametrees, each a vector of
four elements:
(cdddr full)))
gnugo/sgf-*r4-properties*))
p name v spec)
- ;; todo: escape special chars for `text' and `simpletext'.
(cl-labels
- ((>>one (v) (insert (format "[%s]" v)))
- (>>two (v) (insert (format "[%s:%s]" (car v) (cdr v))))
+ ((esc (composed fmt arg)
+ (mapconcat (lambda (c)
+ (case c
+ ;; ‘?\[’ is not strictly required
+ ;; but neither is it forbidden.
+ ((?\[ ?\] ?\\) (format "\\%c" c))
+ (?: (concat (if composed "\\" "") ":"))
+ (t (string c))))
+ (string-to-list (format fmt arg))
+ ""))
+ (>>one (v) (insert "[" (esc nil "%s" v) "]"))
+ (>>two (v) (insert "["
+ (esc t "%s" (car v))
+ ":"
+ (esc t "%s" (cdr v))
+ "]"))
(>>nl () (cond ((memq name aft-newline-appreciated)
(insert "\n"))
((< 60 (current-column))
- [elpa] externals/gnugo 423683d 055/357: [gnugo int] Use ‘dolist’, ‘destructuring-bind’ more., (continued)
- [elpa] externals/gnugo 423683d 055/357: [gnugo int] Use ‘dolist’, ‘destructuring-bind’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7c3a30f 100/357: [gnugo int] Use ‘pop’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a35692a 106/357: [gnugo int] Add abstraction: gnugo--move-prop, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 6ee477d 112/357: [gnugo int] Remove abstraction: continue-on, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 58d4d6d 117/357: [gnugo int] Add abstractions: gnugo--{, set-}tree-ends, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f107328 122/357: [gnugo int] Expand gametree IR: MNUM, KIDS, ROOT., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo c3b3c3f 123/357: [gnugo int] Fix bug: Detect case for KIDS addition correctly., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a63d31b 128/357: [gnugo int] Comment munging; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3a7f75e 132/357: [gnugo] Define "GNUGO Frolic" mode., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo cb78651 138/357: [gnugo frolic] Add command to prune a branch., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7025924 156/357: [gnugo sgf] Fix bug: Add ‘\’-escapes on write.,
Stefan Monnier <=
- [elpa] externals/gnugo e64f1ae 170/357: [gnugo frolic] Add previous/next move navigation commands., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo c78119f 191/357: [gnugo int] Add abstraction: gnugo--finish-move, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a3d90aa 189/357: [gnugo maint] Update HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5dcf9f6 185/357: [gnugo int] Add abstraction: gnugo--node-with-played-stone, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1367651 173/357: [gnugo int] Make ‘gnugo-gate’ slightly faster., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a4c246e 188/357: [gnugo frolic] Display "!" for comment; add as ‘help-echo’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 8203f46 194/357: [gnugo int] Centralize some constant strings., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b1f2856 183/357: [gnugo] Fix bug: Keep subproc informed of forced PASS., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3112192 056/357: [gnugo int] Streamline subproc (de-)marshalling., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 294bdc1 047/357: [gnugo maint] Update NEWS; nfc., Stefan Monnier, 2020/11/29