[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/02: [gnugo frolic int] Add abstraction: gnugo--sideways
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 01/02: [gnugo frolic int] Add abstraction: gnugo--sideways |
Date: |
Sat, 12 Apr 2014 08:46:11 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit 8179f33a6623d3d376152faa2ab9b41b8edc40e6
Author: Thien-Thi Nguyen <address@hidden>
Date: Sat Apr 12 10:37:55 2014 +0200
[gnugo frolic int] Add abstraction: gnugo--sideways
* packages/gnugo/gnugo.el (gnugo--sideways): New func.
(gnugo-frolic-backward-branch, gnugo-frolic-forward-branch): Use it.
---
packages/gnugo/gnugo.el | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 51fbbbe..43b54c5 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -1072,17 +1072,22 @@ This fails if the monkey is on the current branch
(search-forward line)
(gnugo--move-to-bcol (min a (- width 2))))))
+(defun gnugo--sideways (backwards n)
+ (gnugo--awakened nil
+ (gnugo--move-to-bcol (mod (if backwards
+ (- (or a width) n)
+ (+ (or a -1) n))
+ width))))
+
(defun gnugo-frolic-backward-branch (&optional n)
"Move backward N (default 1) branches."
(interactive "p")
- (gnugo--awakened nil
- (gnugo--move-to-bcol (mod (- (or a width) n) width))))
+ (gnugo--sideways t n))
(defun gnugo-frolic-forward-branch (&optional n)
"Move forward N (default 1) branches."
(interactive "p")
- (gnugo--awakened nil
- (gnugo--move-to-bcol (mod (+ (or a -1) n) width))))
+ (gnugo--sideways nil n))
(defun gnugo-boss-is-near ()
"Do `bury-buffer' until the current one is not a GNU Board."