[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/01: [gnugo] Only set AP for modified gametrees in the collecti
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 01/01: [gnugo] Only set AP for modified gametrees in the collection. |
Date: |
Tue, 27 May 2014 10:22:58 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit b151b45b28bf6dabe0ad9d9efc471634d5e86a65
Author: Thien-Thi Nguyen <address@hidden>
Date: Tue May 27 11:56:16 2014 +0200
[gnugo] Only set AP for modified gametrees in the collection.
* packages/gnugo/gnugo.el (gnugo-write-sgf-file):
Set root node property :AP here, but only if buffer-modified.
(gnugo, gnugo/sgf-write-file): Don't set root node property :AP.
---
packages/gnugo/NEWS | 1 +
packages/gnugo/gnugo.el | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/packages/gnugo/NEWS b/packages/gnugo/NEWS
index da45ca6..91047fb 100644
--- a/packages/gnugo/NEWS
+++ b/packages/gnugo/NEWS
@@ -46,6 +46,7 @@ NB: "RCS: X..Y " means that the particular release includes
- GNUGO Board mode now derived from Special mode
- position arg validated for direct GTP commands ‘undo’, ‘gg-undo’
- undo commands no longer signal error on overkill
+ - SGF prop ‘AP’ set only for modified gametrees
- SGF I/O commands change ‘default-directory’
- performance improvements
- of interest to hackers (see source, BI => backward incompatible)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 3097ce1..e42db33 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -1561,6 +1561,9 @@ If FILENAME already exists, Emacs confirms that you wish
to overwrite it."
(when (and (file-exists-p filename)
(not (y-or-n-p "File exists. Continue? ")))
(user-error "Not writing %s" filename))
+ (when (buffer-modified-p)
+ ;; take responsibility for our actions
+ (gnugo--set-root-prop :AP (cons "gnugo.el" gnugo-version)))
(gnugo/sgf-write-file (gnugo-get :sgf-collection) filename)
(gnugo--ok-file filename))
@@ -2280,7 +2283,6 @@ See `gnugo-board-mode' for a full list of commands."
:RU (if (member "--chinese-rules" args)
"Chinese"
"Japanese")
- :AP (cons "gnugo.el" gnugo-version)
:KM komi)
(let ((ub (gnugo--blackp user-color)))
(r! (if ub :PW :PB) (concat "GNU Go " (gnugo-query "version"))
@@ -2655,7 +2657,6 @@ A collection is a list of gametrees, each a vector of
four elements:
(defun gnugo/sgf-write-file (collection filename)
(let ((aft-newline-appreciated '(:AP :GN :PB :PW :HA :KM :RU :RE))
- (me (cons "gnugo.el" gnugo-version))
(specs (mapcar (lambda (full)
(cons (intern (format ":%s" (car full)))
(cl-cdddr full)))
@@ -2723,8 +2724,6 @@ A collection is a list of gametrees, each a vector of
four elements:
(insert ")")))
(with-temp-buffer
(dolist (tree collection)
- ;; take responsibility for our actions
- (gnugo--set-root-prop :AP me tree)
;; write it out
(let ((ht (gnugo--mkht))
(leaves (append (gnugo--tree-ends tree) nil)))