[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 03/03: [gnugo int] Move karma state normalization down-chain.
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 03/03: [gnugo int] Move karma state normalization down-chain. |
Date: |
Wed, 30 Apr 2014 07:30:59 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit fde4e61f363b26b95f4df9c0a67d95376c23fa8e
Author: Thien-Thi Nguyen <address@hidden>
Date: Wed Apr 30 09:34:27 2014 +0200
[gnugo int] Move karma state normalization down-chain.
* packages/gnugo/gnugo.el (gnugo--karma): Always return boolean.
(gnugo--assist-state, gnugo--struggle): Don't normalize here.
---
packages/gnugo/gnugo.el | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index d453d78..9f475dc 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -1726,15 +1726,15 @@ cursor to the suggested position. Prefix arg inhibits
warp."
'nowarp
t)))
-(defun gnugo--karma (color)
- (member color (cdr (gnugo-get :wheel))))
+(defun gnugo--karma (color) ; => BOOL
+ (when (member color (cdr (gnugo-get :wheel)))
+ t))
(defsubst gnugo--:karma (role)
(gnugo--karma (gnugo-get role)))
(defun gnugo--assist-state (&optional gate)
- (let ((bool (when (gnugo--:karma :user-color)
- t)))
+ (let ((bool (gnugo--:karma :user-color)))
(if (and bool gate)
(user-error "Sorry, Assist mode enabled")
bool)))
@@ -2339,10 +2339,7 @@ If COMMENT is nil or the empty string, remove the
property entirely."
(gnugo--decorate node :C comment)))
(defun gnugo--struggle (prop updn)
- (unless (eq ; drudgery avoidance
- (when (gnugo--:karma prop) ; normalize
- t)
- updn)
+ (unless (eq updn (gnugo--:karma prop)) ; drudgery avoidance
(let ((color (gnugo-get prop)))
(if updn
;; enable