[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 92/255: worked around stupid bug in mapconcat
From: |
Eric Schulte |
Subject: |
[elpa] 92/255: worked around stupid bug in mapconcat |
Date: |
Sun, 16 Mar 2014 01:02:26 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit 442283be81fe3631750425f35ba9fae4a39ac6d6
Author: Eric Schulte <address@hidden>
Date: Thu May 24 20:38:29 2012 -0600
worked around stupid bug in mapconcat
Specifically mapconcat will conflate the text properties of the strings
returned by the function passed as its first argument. See below,
(defun propertized-string (length)
(mapconcat (lambda (n)
(let ((str (return-a-point)))
(put-text-property 0 (length str) :number n str)
str))
(range length) " "))
(insert (format "%S" (propertized-string 4)))
;; yields the following which all have the same :number property
#(". . . ." 0 1 (:number 3) 2 3 (:number 3) 4 5 (:number 3) 6 7
(:number 3))
---
sgf-board.el | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/sgf-board.el b/sgf-board.el
index 6fe9bd7..08e9394 100644
--- a/sgf-board.el
+++ b/sgf-board.el
@@ -163,11 +163,13 @@
(defun board-row-to-string (board row)
(let* ((size (board-size board))
(label (format "%3d" (1+ row)))
- (row-body (mapconcat
- (lambda (n)
- (board-pos-to-string board (cons row n)))
- (range size) " ")))
- (concat label " " row-body label)))
+ (row-body ""))
+ (dotimes (n size)
+ (setq row-body
+ (concat row-body
+ (board-pos-to-string board (cons row n))
+ " ")))
+ (concat label " " (substring row-body 0 (1- (length row-body))) label)))
(defun board-body-to-string (board)
(let ((board (transpose-array board)))
- [elpa] 82/255: organization, (continued)
- [elpa] 82/255: organization, Eric Schulte, 2014/03/15
- [elpa] 88/255: made the *back-ends* variable singular, Eric Schulte, 2014/03/15
- [elpa] 57/255: splitting sgf.el into board test and utility files, Eric Schulte, 2014/03/15
- [elpa] 87/255: removed old variable, Eric Schulte, 2014/03/15
- [elpa] 83/255: starting to transition to generic board interface, Eric Schulte, 2014/03/15
- [elpa] 85/255: working with new set less some state-leak issues, Eric Schulte, 2014/03/15
- [elpa] 90/255: moving around major mode and key bindings, Eric Schulte, 2014/03/15
- [elpa] 91/255: adding properties to the board string, Eric Schulte, 2014/03/15
- [elpa] 86/255: playing gnugo, Eric Schulte, 2014/03/15
- [elpa] 94/255: remove old variable from tests, Eric Schulte, 2014/03/15
- [elpa] 92/255: worked around stupid bug in mapconcat,
Eric Schulte <=
- [elpa] 93/255: able to play against gnugo, Eric Schulte, 2014/03/15
- [elpa] 95/255: renaming files for go- prefix, Eric Schulte, 2014/03/15
- [elpa] 98/255: *trackers* are multiple subordinate back-ends, Eric Schulte, 2014/03/15
- [elpa] 89/255: tweaks, Eric Schulte, 2014/03/15
- [elpa] 102/255: simpler name for main go-board function, Eric Schulte, 2014/03/15
- [elpa] 100/255: automated playing with gnugo, Eric Schulte, 2014/03/15
- [elpa] 99/255: single function to play gnugo, Eric Schulte, 2014/03/15
- [elpa] 101/255: now with colors, Eric Schulte, 2014/03/15
- [elpa] 106/255: sgf: go-labels shouldn't increment the index, Eric Schulte, 2014/03/15
- [elpa] 107/255: can now feed moves from gnugo through to sgf, Eric Schulte, 2014/03/15