[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 8cabdfa 042/357: [gnugo int] Use internal macros
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 8cabdfa 042/357: [gnugo int] Use internal macros more. |
Date: |
Sun, 29 Nov 2020 14:50:44 -0500 (EST) |
branch: externals/gnugo
commit 8cabdfa9b14e82e722ec2e3810d38b04cc28c430
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo int] Use internal macros more.
* packages/gnugo/gnugo.el
(:gnugo-gtp-command-spec deffull): New macro.
(:gnugo-gtp-command-spec): Use it for ‘:full’ specs.
---
gnugo.el | 53 ++++++++++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index 7e39431..6bc6e46 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -1850,9 +1850,12 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
(while ls
(jam cmd (car ls) (cadr ls))
(setq ls (cddr ls)))))))
+ (cl-macrolet ((deffull (who &body body)
+ (declare (indent 1))
+ `(defgtp ',who :full (lambda (sel)
+ ,@body))))
- (defgtp 'help :full
- (lambda (sel)
+ (deffull help
(info "(gnugo)GTP command reference")
(when sel (setq sel (intern (car sel))))
(let (buffer-read-only pad cur spec output found)
@@ -1883,29 +1886,29 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
(setq found (match-beginning 0))))))
(cond (found (goto-char found))
((not sel))
- (t (message "(no such command: %s)" sel))))))
-
- (defgtp 'final_score :full
- (lambda (sel) (gnugo-display-final-score)))
-
- (defgtp '(boardsize
- clear_board
- fixed_handicap)
- :output :discard
- :post-thunk (lambda ()
- (gnugo--unclose-game)
- (gnugo-put :last-mover nil)
- (gnugo-refresh t)))
-
- (defgtp 'loadsgf :full
- (lambda (sel) (gnugo-read-sgf-file (car sel))))
-
- (defgtp '(undo gg-undo) :full
- (lambda (sel) (gnugo-magic-undo
- (let (n)
- (cond ((not sel) 1)
- ((cl-plusp (setq n (string-to-number (car sel))))
n)
- (t (car sel)))))))))
+ (t (message "(no such command: %s)" sel)))))
+
+ (deffull final_score
+ (gnugo-display-final-score))
+
+ (defgtp '(boardsize
+ clear_board
+ fixed_handicap)
+ :output :discard
+ :post-thunk (lambda ()
+ (gnugo--unclose-game)
+ (gnugo-put :last-mover nil)
+ (gnugo-refresh t)))
+
+ (deffull loadsgf
+ (gnugo-read-sgf-file (car sel)))
+
+ (deffull (undo gg-undo)
+ (gnugo-magic-undo
+ (let (n)
+ (cond ((not sel) 1)
+ ((cl-plusp (setq n (string-to-number (car sel)))) n)
+ (t (car sel)))))))))
(provide 'gnugo)
- [elpa] externals/gnugo c78119f 191/357: [gnugo int] Add abstraction: gnugo--finish-move, (continued)
- [elpa] externals/gnugo c78119f 191/357: [gnugo int] Add abstraction: gnugo--finish-move, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a3d90aa 189/357: [gnugo maint] Update HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5dcf9f6 185/357: [gnugo int] Add abstraction: gnugo--node-with-played-stone, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1367651 173/357: [gnugo int] Make ‘gnugo-gate’ slightly faster., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a4c246e 188/357: [gnugo frolic] Display "!" for comment; add as ‘help-echo’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 8203f46 194/357: [gnugo int] Centralize some constant strings., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b1f2856 183/357: [gnugo] Fix bug: Keep subproc informed of forced PASS., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3112192 056/357: [gnugo int] Streamline subproc (de-)marshalling., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 294bdc1 047/357: [gnugo maint] Update NEWS; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b5f47cb 059/357: [gnugo int] Use ‘pcase’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 8cabdfa 042/357: [gnugo int] Use internal macros more.,
Stefan Monnier <=
- [elpa] externals/gnugo b484515 064/357: [gnugo int] Use ‘loop’, functional style more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a7dffa0 067/357: [gnugo maint] Update NEWS; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo d2b4549 068/357: [gnugo] Bind ‘M-u’ to ‘gnugo-undo-one-move’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f82c526 078/357: [gnugo int] Use ‘following-char’ instead of ‘char-after’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f29b22f 081/357: [gnugo int] Use ‘setq’ less., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 38137d3 079/357: [gnugo int] Cache gametree prop ‘:SZ’ as gnugo prop ‘:SZ’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo d6f3956 089/357: [gnugo int] Decruft: Infer MOVEP from PROPERTY., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5ca5b0a 097/357: [gnugo int] Add abstraction: gnugo--nodep, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a86a897 013/357: [gnugo int] Use ‘redisplay’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3063f95 041/357: [gnugo] Make proc-status change mode-line elem more informative., Stefan Monnier, 2020/11/29