;; Author: Thien-Thi Nguyen <ttn@gnu.org>
;; Maintainer: Thien-Thi Nguyen <ttn@gnu.org>
-;; Version: 2.3.1
-;; Package-Requires: ((ascii-art-to-unicode "1.5") (xpm "1.0.0") (cl-lib "0.5"))
+;; Version: 3.0.0
+;; Package-Requires: ((ascii-art-to-unicode "1.5") (xpm "1.0.1") (cl-lib "0.5"))
;; Keywords: games, processes
+;; URL: http://www.gnuvola.org/software/gnugo/
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; Meta-Meta-Playing (aka Hacking)
;; -------------------------------
;;
-;; <http://git.sv.gnu.org/cgit/emacs/elpa.git/tree/packages/gnugo/HACKING>
-;;
-;;
-;; Tip Jar
-;; -------
-;;
-;; <http://www.gnuvola.org/software/gnugo/>
+;; <http://git.sv.gnu.org/cgit/emacs/elpa.git/tree/packages/gnugo/>
;;; Code:
;;;---------------------------------------------------------------------------
;;; Political arts
-(defconst gnugo-version "2.3.1"
+(defconst gnugo-version "3.0.0"
"Version of gnugo.el currently loaded.
This follows a MAJOR.MINOR.PATCH scheme.")
(if (string= "" d)
".+\n"
""))))
- (while (re-search-forward rx (point-max) t)
+ (while (re-search-forward rx nil t)
(let ((pos (get-text-property (string-to-number (match-string 1))
'gnugo-position buf)))
(delete-region (+ 2 (match-beginning 0)) (point))
(setplist (gnugo-f 'ispc) (and new '(display (space :width 0))))
(gnugo-put :highlight-last-move-spec
(if new
- '((lambda (p)
- (get (gnugo-yy (get-text-property p 'gnugo-yin)
- (get-text-property p 'gnugo-yang)
- t)
- 'display))
+ `(,(lambda (p)
+ (get (gnugo-yy (get-text-property p 'gnugo-yin)
+ (get-text-property p 'gnugo-yang)
+ t)
+ 'display))
0 delete-overlay)
(gnugo-get :default-highlight-last-move-spec)))
;; a kludge to be reworked another time perhaps by another gnugo.el lover
(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))
(cl-flet
((yep (pretty moment)
(push (format-time-string
- (concat pretty ": %Y-%m-%d %H:%M:%S %z\n")
+ (concat pretty ": %F %T %z\n")
moment)
blurb)))
(yep "Game start" beg)
(when (and (zerop handicap) actually)
(setq handicap (string-to-number (cadr actually)))))
(r! :SZ board-size
- :DT (format-time-string "%Y-%m-%d")
+ :DT (format-time-string "%F")
: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"))
(goto-char (point-min))
(save-excursion
(while (re-search-forward "^ *[*] \\([a-zA-Z_]+\\)\\(:.*\\)*\n"
- (point-max) t)
+ nil t)
(unless pad
(setq pad (make-string (- (match-beginning 1)
(match-beginning 0))
(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)))
(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)))