[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 02/06: [gnugo int] Use internal macros more.
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 02/06: [gnugo int] Use internal macros more. |
Date: |
Sat, 22 Feb 2014 12:52:29 +0000 |
ttn pushed a commit to branch ttn-gnugo
in repository elpa.
commit 6c7a24b2e2b124cbc523b070652bea53d3d23b2c
Author: Thien-Thi Nguyen <address@hidden>
Date: Thu Feb 20 12:50:30 2014 +0100
[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.
---
packages/gnugo/gnugo.el | 53 ++++++++++++++++++++++++----------------------
1 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 7e39431..6bc6e46 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/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] branch ttn-gnugo updated (95bf8e2 -> 1f3d9d6), Thien-Thi Nguyen, 2014/02/22
- [elpa] 02/06: [gnugo int] Use internal macros more.,
Thien-Thi Nguyen <=
- [elpa] 03/06: [gnugo maint] Update HACKING; nfc., Thien-Thi Nguyen, 2014/02/22
- [elpa] 06/06: [gnugo] New command: ‘ _’ and ‘M-_’ (gnugo-boss-is-near), Thien-Thi Nguyen, 2014/02/22
- [elpa] 04/06: [gnugo] Bind ‘DEL’ t o ‘gnugo-undo-two-moves’., Thien-Thi Nguyen, 2014/02/22
- [elpa] 01/06: [gnugo] Make proc-status change mode-line elem more informative., Thien-Thi Nguyen, 2014/02/22
- [elpa] 05/06: [gnugo] New command: ‘ A’ (gnugo-switch-to-another), Thien-Thi Nguyen, 2014/02/22