ttn pushed a commit to branch master in repository elpa. commit 8face8768b05d793ece5d390d1e03157fe350375 Author: Thien-Thi Nguyen <t...@gnu.org> Date: Fri May 2 06:47:03 2014 +0200
[gnugo] Make SGF I/O commands change ‘default-directory’. * packages/gnugo/gnugo.el (gnugo--ok-file): New func. (gnugo-write-sgf-file, gnugo-read-sgf-file): Don't clear buffer-modified state; instead, call ‘gnugo--ok-file’. --- packages/gnugo/NEWS | 1 + packages/gnugo/gnugo.el | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/gnugo/NEWS b/packages/gnugo/NEWS index 026d67d..1650be8 100644 --- a/packages/gnugo/NEWS +++ b/packages/gnugo/NEWS @@ -36,6 +36,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 I/O commands change ‘default-directory’ - performance improvements - of interest to hackers (see source, BI => backward incompatible) - dropped var: ‘gnugo-inhibit-refresh’ (BI) diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el index a01ae63..4a6d002 100644 --- a/packages/gnugo/gnugo.el +++ b/packages/gnugo/gnugo.el @@ -1897,6 +1897,12 @@ by how many stones)." (message "Est.score ... B %s %s | W %s %s | %s" black black-captures white white-captures est))) +(defun gnugo--ok-file (filename) + (setq default-directory + (file-name-directory + (expand-file-name filename))) + (set-buffer-modified-p nil)) + (defun gnugo-write-sgf-file (filename) "Save the game history to FILENAME (even if unfinished). If FILENAME already exists, Emacs confirms that you wish to overwrite it." @@ -1905,7 +1911,7 @@ If FILENAME already exists, Emacs confirms that you wish to overwrite it." (not (y-or-n-p "File exists. Continue? "))) (user-error "Not writing %s" filename)) (gnugo/sgf-write-file (gnugo-get :sgf-collection) filename) - (set-buffer-modified-p nil)) + (gnugo--ok-file filename)) (defun gnugo--dance-dance (karma) (destructuring-bind (dance btw) @@ -2000,7 +2006,7 @@ If FILENAME already exists, Emacs confirms that you wish to overwrite it." (gnugo-put :last-user-bpos (gnugo-move-history 'bpos (gnugo-get :user-color))) (gnugo-refresh t) - (set-buffer-modified-p nil) + (gnugo--ok-file filename) (gnugo--who-is-who wait play samep))) (defun gnugo--mem-with-played-stone (pos &optional noerror)