[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/01: [gnugo int] Add abstraction: gnugo--move-to-bcol
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 01/01: [gnugo int] Add abstraction: gnugo--move-to-bcol |
Date: |
Wed, 09 Apr 2014 06:58:59 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit f5fab92124534c375cf71596a7756086eaed5a65
Author: Thien-Thi Nguyen <address@hidden>
Date: Wed Apr 9 08:46:45 2014 +0200
[gnugo int] Add abstraction: gnugo--move-to-bcol
* packages/gnugo/gnugo.el (gnugo--move-to-bcol): New defsubst.
(gnugo--swiz, gnugo-frolic-prune-branch)
(gnugo-frolic-backward-branch)
(gnugo-frolic-forward-branch): Use it.
---
packages/gnugo/gnugo.el | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 951881a..363409b 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -954,6 +954,9 @@ are dimmed. Type \\[describe-mode] in that buffer for
details."
(gnugo--awake)
,@body))
+(defsubst (gnugo--move-to-bcol bidx)
+ (move-to-column (+ 10 (* 6 bidx))))
+
(defun gnugo--swiz (direction &optional blunt)
(gnugo--awakened
(unless a
@@ -980,7 +983,7 @@ are dimmed. Type \\[describe-mode] in that buffer for
details."
(gnugo-frolic-in-the-leaves)
(goto-char (point-min))
(forward-line line)
- (forward-char (+ 10 (* 6 b))))))
+ (gnugo--move-to-bcol b))))
(defun gnugo-frolic-exchange-left ()
"Exchange the current branch with the one to its left."
@@ -1036,19 +1039,19 @@ This fails if the monkey is on the current branch
(when line
(goto-char (point-min))
(search-forward line)
- (move-to-column (+ 10 (* 6 (min a (- width 2))))))))
+ (gnugo--move-to-bcol (min a (- width 2))))))
(defun gnugo-frolic-backward-branch (&optional n)
"Move backward N (default 1) branches."
(interactive "p")
(gnugo--awakened
- (move-to-column (+ 10 (* 6 (mod (- (or a width) n) width))))))
+ (gnugo--move-to-bcol (mod (- (or a width) n) width))))
(defun gnugo-frolic-forward-branch (&optional n)
"Move forward N (default 1) branches."
(interactive "p")
(gnugo--awakened
- (move-to-column (+ 10 (* 6 (mod (+ (or a -1) n) width))))))
+ (gnugo--move-to-bcol (mod (+ (or a -1) n) width))))
(defun gnugo-boss-is-near ()
"Do `bury-buffer' until the current one is not a GNU Board."