[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 21/51: [gnugo gtp int] Use :post-thunk instead of :post-hook.
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 21/51: [gnugo gtp int] Use :post-thunk instead of :post-hook. |
Date: |
Mon, 24 Feb 2014 12:30:19 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit 7a11a8f473149e4cf530198c7e88397f54a1b2f3
Author: Thien-Thi Nguyen <address@hidden>
Date: Wed Feb 5 11:34:00 2014 +0100
[gnugo gtp int] Use :post-thunk instead of :post-hook.
* packages/gnugo/gnugo.el (gnugo-command):
Consult :post-thunk, if set, ‘funcall’ the value.
(:gnugo-gtp-command-spec add): Delete.
(:gnugo-gtp-command-spec defgtp): Use ‘jam’ unconditionally.
(:gnugo-gtp-command-spec): Do ‘s/:post-hook/:post-thunk/g’.
---
packages/gnugo/gnugo.el | 26 ++++++++------------------
1 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 7d82e29..a10994d 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -1499,7 +1499,7 @@ Also, add the `:RE' SGF property to the root node of the
game tree."
;; "*gnugo command output*" if the output has a newline,
;; otherwise use `message'.
;;
-;; :post-hook -- normal hook run after output processing (at the very end).
+;; :post-thunk -- run after output processing (at the very end).
(defun gnugo-command (command)
"Send the Go Text Protocol COMMAND (a string) to GNU Go.
@@ -1538,10 +1538,8 @@ NOTE: At this time, GTP command handling specification
is still
(erase-buffer)
(insert ans)
(message "Doing %s ... done." command)))
- (let ((hook
- ;; do not elide this binding; `run-hooks' needs it
- (plist-get spec :post-hook)))
- (run-hooks 'hook))))))))
+ (let ((thunk (plist-get spec :post-thunk)))
+ (when thunk (funcall thunk)))))))))
;;;---------------------------------------------------------------------------
;;; Major mode for interacting with a GNUGO subprocess
@@ -1832,18 +1830,10 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
((sget (x) (get x :gnugo-gtp-command-spec))
(jam (cmd prop val) (put cmd :gnugo-gtp-command-spec
(plist-put (sget cmd) prop val)))
- (add (cmd prop val) (jam cmd prop (let ((cur (plist-get
- (sget cmd)
- prop)))
- (append (delete val cur)
- (list val)))))
(defgtp (x &rest props) (dolist (cmd (if (symbolp x) (list x) x))
(let ((ls props))
(while ls
- (funcall (if (eq :post-hook (car ls))
- #'add
- #'jam)
- cmd (car ls) (cadr ls))
+ (jam cmd (car ls) (cadr ls))
(setq ls (cddr ls)))))))
(defgtp 'help :full
@@ -1887,10 +1877,10 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
clear_board
fixed_handicap)
:output :discard
- :post-hook (lambda ()
- (gnugo-put :game-over nil)
- (gnugo-put :last-mover nil)
- (gnugo-refresh t)))
+ :post-thunk (lambda ()
+ (gnugo-put :game-over nil)
+ (gnugo-put :last-mover nil)
+ (gnugo-refresh t)))
(defgtp 'loadsgf :full
(lambda (sel) (gnugo-read-sgf-file (car sel))))
- [elpa] 35/51: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’., (continued)
- [elpa] 35/51: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’., Thien-Thi Nguyen, 2014/02/24
- [elpa] 28/51: [gnugo int] Drop leading "*" in docstrings., Thien-Thi Nguyen, 2014/02/24
- [elpa] 26/51: [gnugo] Give names and docstr ings to ‘lambda’ commands., Thien-Thi Nguyen, 2014/02/24
- [elpa] 38/51: [gnugo] Fix bug: Relax sync regexp., Thien-Thi Nguyen, 2014/02/24
- [elpa] 39/51: [gnugo] Don't show underscore in group-animation message., Thien-Thi Nguyen, 2014/02/24
- [elpa] 36/51: [gnugo int] Revamp gnugo-{put, get} doc / indentation decl., Thien-Thi Nguyen, 2014/02/24
- [elpa] 37/51: [gnugo maint] Update "next" in HACKING; nfc., Thien-Thi Nguyen, 2014/02/24
- [elpa] 32/51: [gnugo] Use ‘user-erro r’., Thien-Thi Nguyen, 2014/02/24
- [elpa] 02/51: Import gnugo.el from ttn-pers-elisp 1.59., Thien-Thi Nguyen, 2014/02/24
- [elpa] 40/51: [gnugo] Use special constructs for keybindings in docstrings., Thien-Thi Nguyen, 2014/02/24
- [elpa] 21/51: [gnugo gtp int] Use :post-thunk instead of :post-hook.,
Thien-Thi Nguyen <=
- [elpa] 31/51: [gnugo int] Add abstraction: gnugo--unclose-game, Thien-Thi Nguyen, 2014/02/24
- [elpa] 45/51: [gnugo] New command: ‘ A’ (gnugo-switch-to-another), Thien-Thi Nguyen, 2014/02/24
- [elpa] 42/51: [gnugo int] Use internal macros more., Thien-Thi Nguyen, 2014/02/24
- [elpa] 46/51: [gnugo] New command: ‘ _’ and ‘M-_’ (gnugo-boss-is-near), Thien-Thi Nguyen, 2014/02/24
- [elpa] 43/51: [gnugo maint] Update HACKING; nfc., Thien-Thi Nguyen, 2014/02/24
- [elpa] 50/51: [gnugo maint] Update NEWS, HACKING; nfc., Thien-Thi Nguyen, 2014/02/24
- [elpa] 41/51: [gnugo] Make proc-status change mode-line elem more informative., Thien-Thi Nguyen, 2014/02/24
- [elpa] 47/51: [gnugo maint] Update NEWS; nfc., Thien-Thi Nguyen, 2014/02/24
- [elpa] 48/51: [gnugo] Fix bug: Compute grid spacing using offset math., Thien-Thi Nguyen, 2014/02/24
- [elpa] 49/51: [gnugo] Rename var to ‘gnugo-inhibit-refresh’., Thien-Thi Nguyen, 2014/02/24