[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 0838a13 021/357: [gnugo gtp int] Use :post-thunk
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 0838a13 021/357: [gnugo gtp int] Use :post-thunk instead of :post-hook. |
Date: |
Sun, 29 Nov 2020 14:50:39 -0500 (EST) |
branch: externals/gnugo
commit 0838a137de2ff2d853444955b61421e7be7e7205
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[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’.
---
gnugo.el | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index 7d82e29..a10994d 100644
--- a/gnugo.el
+++ b/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] externals/gnugo c31cfb0 003/357: [gnugo] Adapt copyright notice to FSF, headers to ELPA., (continued)
- [elpa] externals/gnugo c31cfb0 003/357: [gnugo] Adapt copyright notice to FSF, headers to ELPA., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo aedeff7 004/357: [gnugo maint] Add NEWS file; prune Commentary; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo fdb7810 005/357: [gnugo] Use ‘cl-labels’ instead of ‘flet’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 9ec0f3e 007/357: [gnugo] Presume "modern" GNU Emacs., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0893d87 010/357: [gnugo] Don't use ‘process-kill-buffer-query-function’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7484ea0 011/357: [gnugo maint] Add HACKING; prune Commentary; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5b0f262 012/357: [gnugo doc] Document version-number scheme., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo fee8b33 015/357: [gnugo int] Use ‘(split-string STR SEP t)’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7f961b7 016/357: [gnugo maint] Update "next" in HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f84b823 018/357: [gnugo maint] Update a musing item in HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0838a13 021/357: [gnugo gtp int] Use :post-thunk instead of :post-hook.,
Stefan Monnier <=
- [elpa] externals/gnugo e16a8d5 031/357: [gnugo int] Add abstraction: gnugo--unclose-game, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 28da1b4 035/357: [gnugo int] Use ‘dolist’ and ‘destructuring-bind’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 08b2a66 017/357: [gnugo] Indicate buffer not modified after save., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 9893ff1 027/357: [gnugo int] Hang the sync-return-stash on the process object., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b8b8763 037/357: [gnugo maint] Update "next" in HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a4b96a1 024/357: [gnugo int] Use ‘number-sequence’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 402bf68 039/357: [gnugo] Don't show underscore in group-animation message., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7647c9c 062/357: [gnugo int] Avoid redundant calls to ‘gnugo-get’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo fef1847 040/357: [gnugo] Use special constructs for keybindings in docstrings., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5c8f31d 043/357: [gnugo maint] Update HACKING; nfc., Stefan Monnier, 2020/11/29