[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo bcc912b 164/357: [gnugo frolic int] Add var selec
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo bcc912b 164/357: [gnugo frolic int] Add var selection to awakening parameterization. |
Date: |
Sun, 29 Nov 2020 14:51:13 -0500 (EST) |
branch: externals/gnugo
commit bcc912b3bba51872bf24720791034a16fac197ec
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo frolic int] Add var selection to awakening parameterization.
This eliminates unused local vars for the affected funcs.
* packages/gnugo/gnugo.el (gnugo--awake):
Check HOW for ‘(omit NAME ...)’ and arrange to omit NAME...
from the return value; return a simple list, w/o ‘values’.
(gnugo--awakened): Use ‘destructuring-bind’ instead of
‘multiple-value-bind’; construct its ARGS parameter
based on ‘(omit NAME ...)’ in HOW.
(gnugo--swiz): Omit ‘tree’.
(gnugo--sideways): Omit ‘tree’, ‘ends’, ‘monkey’, ‘bidx’, ‘line’.
---
gnugo.el | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index 43b54c5..c2d228b 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -975,20 +975,32 @@ are dimmed. Type \\[describe-mode] in that buffer for
details."
(let ((try (/ (- col 10)
6)))
(unless (<= width try)
- try)))))
+ try))))
+ (rv (list a)))
(when (memq 'require-valid-branch how)
(unless a
(user-error "No branch here")))
- (values tree ends width
- monkey (aref monkey 1)
- line a)))
+ (loop with omit = (cdr (assq 'omit how))
+ for (name . value) in `((line . ,line)
+ (bidx . ,(aref monkey 1))
+ (monkey . ,monkey)
+ (width . ,width)
+ (ends . ,ends)
+ (tree . ,tree))
+ do (unless (memq name omit)
+ (push value rv)))
+ rv))
(defmacro gnugo--awakened (how &rest body)
(declare (indent 1))
- `(multiple-value-bind (tree ends width
- monkey bidx
- line
- a)
+ `(destructuring-bind ,(loop with omit = (cdr (assq 'omit how))
+ with ls = (list 'a)
+ for name in '(line bidx monkey
+ width ends
+ tree)
+ do (unless (memq name omit)
+ (push name ls))
+ finally return ls)
(gnugo--awake ',how)
,@body))
@@ -997,6 +1009,7 @@ are dimmed. Type \\[describe-mode] in that buffer for
details."
(defun gnugo--swiz (direction &optional blunt)
(gnugo--awakened (require-valid-branch
+ (omit tree)
(line . numeric))
(let* ((b (cond ((numberp blunt)
(unless (and (< -1 blunt)
@@ -1073,7 +1086,7 @@ This fails if the monkey is on the current branch
(gnugo--move-to-bcol (min a (- width 2))))))
(defun gnugo--sideways (backwards n)
- (gnugo--awakened nil
+ (gnugo--awakened ((omit tree ends monkey bidx line))
(gnugo--move-to-bcol (mod (if backwards
(- (or a width) n)
(+ (or a -1) n))
- [elpa] externals/gnugo e8833a9 161/357: [gnugo int] Fix syntax error in ‘loop’ destructuring., (continued)
- [elpa] externals/gnugo e8833a9 161/357: [gnugo int] Fix syntax error in ‘loop’ destructuring., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3e3fbea 155/357: [gnugo sgf] Fix bug: Preserve whitespace for ‘text’ values., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0f3f4b6 165/357: [gnugo int] Use ‘ignore’ to avoid byte-compiler warnings., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 082d56c 178/357: [gnugo int] Use ‘gnugo--decorate’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e382633 190/357: [gnugo] Drop var: gnugo-inhibit-refresh, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo dd6b6f8 186/357: [gnugo] New command: ‘C’ (gnugo-comment), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo cba406b 176/357: [gnugo] Include root node in :sgf-gametree description., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1ac646f 172/357: [gnugo] New command: ‘O’ (gnugo-okay), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3f13bbf 168/357: [gnugo] Make ‘=’ also display move number., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f3c90cd 187/357: [gnugo] Make ‘C-u F’ add the blurb as a comment to the last node., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bcc912b 164/357: [gnugo frolic int] Add var selection to awakening parameterization.,
Stefan Monnier <=
- [elpa] externals/gnugo 66c29d0 197/357: [gnugo int] Add abstraction: gnugo--gate-game-over, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5bbec0e 179/357: [gnugo int] Incorporate ‘gnugo-note’ into unique caller., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 82b6000 198/357: [gnugo] Mention ‘gnugo-frolic-mode-hook’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 32e8547 199/357: [gnugo int] Add abstraction: gnugo--user-play, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 001228c 205/357: [gnugo] Drop support for ‘(gnugo-move-history 'count)’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 106a279 211/357: [gnugo int] Consolidate paren overlays access., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 17d907d 210/357: [gnugo int] Shave one ‘gnugo-other’ call., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1d6b241 214/357: [gnugo] Use ‘define-derived-mode’ for GNUGO Board mode., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 167ba89 213/357: [gnugo int] Decruft: Streamline game-over handling on SGF load., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b3d3da0 220/357: [gnugo int] Use functional style more., Stefan Monnier, 2020/11/29