[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 08/10: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’.
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 08/10: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’. |
Date: |
Sat, 15 Feb 2014 11:58:32 +0000 |
ttn pushed a commit to branch ttn-gnugo
in repository elpa.
commit 83e7550e394f7ae8d4af636dbcc8d25f33dc5256
Author: Thien-Thi Nguyen <address@hidden>
Date: Sat Feb 15 12:07:42 2014 +0100
[gnugo int] Use ‘dolist’ and ‘destructuring-bind’.
* packages/gnugo/gnugo.el (gnugo-board-mode): ...here,
instead of ‘mapc’ and ‘apply (lambda () ...)’.
---
packages/gnugo/ChangeLog | 9 ++++++++-
packages/gnugo/gnugo.el | 30 ++++++++++++++----------------
2 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/packages/gnugo/ChangeLog b/packages/gnugo/ChangeLog
index 81167a0..cebbc0d 100644
--- a/packages/gnugo/ChangeLog
+++ b/packages/gnugo/ChangeLog
@@ -1,4 +1,11 @@
-2014-02-15 Thien-Thi Nguyen <address@hidden>
+2014-02-15 Thien-Thi Nguyen <address@hidden>
+
+ [gnugo int] Use ‘dolist’ and ‘destructuring-bind’.
+
+ * gnugo.el (gnugo-board-mode): ...here,
+ instead of ‘mapc’ and ‘apply (lambda () ...)’.
+
+2014-02-15 Thien-Thi Nguyen <address@hidden>
[gnugo int] Use ‘set-process-query-on-exit-flag’.
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 1d5d5a5..340c46e 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -1692,22 +1692,20 @@ In this mode, keys do not self insert. Default
keybindings:
'gnugo-option-history))
(rules "Japanese")
board-size user-color handicap komi minus-l infile)
- (mapc (lambda (x)
- (apply (lambda (var default opt &optional rx)
- (set var
- (or (when (string-match opt args)
- (let ((start (match-end 0)) s)
- (string-match (or rx "[0-9.]+") args start)
- (setq s (match-string 0 args))
- (if rx s (string-to-number s))))
- default)))
- x))
- '((board-size 19 "--boardsize")
- (user-color "black" "--color" "\\(black\\|white\\)")
- (handicap 0 "--handicap")
- (komi 0.0 "--komi")
- (minus-l nil "\\([^-]\\|^\\)-l[ ]*" "[^ ]+")
- (infile nil "--infile" "[ ]*[^ ]+")))
+ (dolist (x '((board-size 19 "--boardsize")
+ (user-color "black" "--color" "\\(black\\|white\\)")
+ (handicap 0 "--handicap")
+ (komi 0.0 "--komi")
+ (minus-l nil "\\([^-]\\|^\\)-l[ ]*" "[^ ]+")
+ (infile nil "--infile" "[ ]*[^ ]+")))
+ (destructuring-bind (var default opt &optional rx) x
+ (set var
+ (or (when (string-match opt args)
+ (let ((start (match-end 0)) s)
+ (string-match (or rx "[0-9.]+") args start)
+ (setq s (match-string 0 args))
+ (if rx s (string-to-number s))))
+ default))))
(gnugo-put :user-color user-color)
(when (string-match "--chinese-rules" args)
(setq rules "Chinese"))
- [elpa] branch ttn-gnugo updated (cfa23d6 -> 5d7da3f), Thien-Thi Nguyen, 2014/02/15
- [elpa] 06/10: [gnugo int] Zonk unused local var., Thien-Thi Nguyen, 2014/02/15
- [elpa] 02/10: [gnugo maint] Update NEWS file; nfc., Thien-Thi Nguyen, 2014/02/15
- [elpa] 04/10: [gnugo int] Add abstraction: gnugo--unclose-game, Thien-Thi Nguyen, 2014/02/15
- [elpa] 07/10: [gnugo int] Use ‘set-p rocess-query-on-exit-flag’., Thien-Thi Nguyen, 2014/02/15
- [elpa] 05/10: [gnugo] Use ‘user-erro r’., Thien-Thi Nguyen, 2014/02/15
- [elpa] 10/10: [gnugo maint] Update "next" in HACKING; nfc., Thien-Thi Nguyen, 2014/02/15
- [elpa] 09/10: [gnugo int] Revamp gnugo-{put, get} doc / indentation decl., Thien-Thi Nguyen, 2014/02/15
- [elpa] 03/10: [gnugo maint] Sync ChangeLog email addr w/ that in VCS commit message; nfc., Thien-Thi Nguyen, 2014/02/15
- [elpa] 01/10: [gnugo] Indicate buffer not modified after load., Thien-Thi Nguyen, 2014/02/15
- [elpa] 08/10: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’.,
Thien-Thi Nguyen <=