[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 35/51: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’.
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 35/51: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’. |
Date: |
Mon, 24 Feb 2014 12:30:24 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit 965d606373deedecdd1ed43e01dae9a3ad6bbba2
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/gnugo.el | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
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] 23/51: [gnugo int] Drop unused local var., (continued)
- [elpa] 23/51: [gnugo int] Drop unused local var., Thien-Thi Nguyen, 2014/02/24
- [elpa] 24/51: [gnugo int] Use ‘numbe r-sequence’ more., Thien-Thi Nguyen, 2014/02/24
- [elpa] 18/51: [gnugo maint] Update a musing item in HACKING; nfc., Thien-Thi Nguyen, 2014/02/24
- [elpa] 25/51: [gnugo int] Use cl-{plus,minus}p more., Thien-Thi Nguyen, 2014/02/24
- [elpa] 27/51: [gnugo int] Hang the sync-return-stash on the process object., Thien-Thi Nguyen, 2014/02/24
- [elpa] 22/51: [gnugo maint] Add .dir-locals.el file, link in HACKING; nfc., Thien-Thi Nguyen, 2014/02/24
- [elpa] 29/51: [gnugo] Indicate buffer not modified after load., Thien-Thi Nguyen, 2014/02/24
- [elpa] 30/51: [gnugo maint] Update NEWS file; nfc., Thien-Thi Nguyen, 2014/02/24
- [elpa] 34/51: [gnugo int] Use ‘set-p rocess-query-on-exit-flag’., Thien-Thi Nguyen, 2014/02/24
- [elpa] 33/51: [gnugo int] Zonk unused local var., Thien-Thi Nguyen, 2014/02/24
- [elpa] 35/51: [gnugo int] Use ‘dolis t’ and ‘destructuring-bind’.,
Thien-Thi Nguyen <=
- [elpa] 28/51: [gnugo int] Drop leading "*" in docstrings., Thien-Thi Nguyen, 2014/02/24
- [elpa] 26/51: [gnugo] Give names and docstr ings to ‘lambda’ commands., Thien-Thi Nguyen, 2014/02/24
- [elpa] 38/51: [gnugo] Fix bug: Relax sync regexp., Thien-Thi Nguyen, 2014/02/24
- [elpa] 39/51: [gnugo] Don't show underscore in group-animation message., Thien-Thi Nguyen, 2014/02/24
- [elpa] 36/51: [gnugo int] Revamp gnugo-{put, get} doc / indentation decl., Thien-Thi Nguyen, 2014/02/24
- [elpa] 37/51: [gnugo maint] Update "next" in HACKING; nfc., Thien-Thi Nguyen, 2014/02/24
- [elpa] 32/51: [gnugo] Use ‘user-erro r’., Thien-Thi Nguyen, 2014/02/24
- [elpa] 02/51: Import gnugo.el from ttn-pers-elisp 1.59., Thien-Thi Nguyen, 2014/02/24
- [elpa] 40/51: [gnugo] Use special constructs for keybindings in docstrings., Thien-Thi Nguyen, 2014/02/24
- [elpa] 21/51: [gnugo gtp int] Use :post-thunk instead of :post-hook., Thien-Thi Nguyen, 2014/02/24