emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master b9015f5 3/3: [gnugo int] Simplify SGF-write subroutine.


From: Thien-Thi Nguyen
Subject: [elpa] master b9015f5 3/3: [gnugo int] Simplify SGF-write subroutine.
Date: Mon, 6 Feb 2017 20:54:30 +0000 (UTC)

branch: master
commit b9015f511a2de5ff340c5a1f5e0eb7d8c8004336
Author: Thien-Thi Nguyen <address@hidden>
Commit: Thien-Thi Nguyen <address@hidden>

    [gnugo int] Simplify SGF-write subroutine.
    
    * packages/gnugo/gnugo.el (gnugo/sgf-write-file esc):
    Drop 2nd arg FMT; rename remaining 2nd arg from ARG to VAL;
    don't bother w/ ‘list-to-string’; if ARG is already a
    string, use it directly; otherwise ‘format "%s"’ as before.
    (gnugo/sgf-write-file >>one): Update call to ‘esc’.
    (gnugo/sgf-write-file >>two): Likewise.
---
 packages/gnugo/gnugo.el |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 7245a3d..ddfc953 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -2680,7 +2680,7 @@ A collection is a list of gametrees, each a vector of 
four elements:
                        gnugo/sgf-*r4-properties*))
         p name v spec)
     (cl-labels
-        ((esc (composed fmt arg)
+        ((esc (composed val)
               (mapconcat (lambda (c)
                            (cl-case c
                              ;; ‘?\[’ is not strictly required
@@ -2688,13 +2688,15 @@ A collection is a list of gametrees, each a vector of 
four elements:
                              ((?\[ ?\] ?\\) (format "\\%c" c))
                              (?: (concat (if composed "\\" "") ":"))
                              (t (string c))))
-                         (string-to-list (format fmt arg))
+                         ;; ‘list-to-string’ unnecessary; ‘mapconcat’ DTRT
+                         (if (stringp val)
+                             val
+                           (format "%s" val))
                          ""))
-         (>>one (v) (insert "[" (esc nil "%s" v) "]"))
-         (>>two (v) (insert "["
-                            (esc t "%s" (car v))
-                            ":"
-                            (esc t "%s" (cdr v))
+         (>>one (v) (insert "[" (esc nil v)
+                            "]"))
+         (>>two (v) (insert "[" (esc t (car v))
+                            ":" (esc t (cdr v))
                             "]"))
          (>>nl () (cond ((memq name aft-newline-appreciated)
                          (insert "\n"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]