ttn pushed a commit to branch master in repository elpa. commit 7a11a8f473149e4cf530198c7e88397f54a1b2f3 Author: Thien-Thi Nguyen <t...@gnu.org> 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))))