emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/gnugo 843cd96 163/357: [gnugo frolic int] Add abstracti


From: Stefan Monnier
Subject: [elpa] externals/gnugo 843cd96 163/357: [gnugo frolic int] Add abstraction: gnugo--sideways
Date: Sun, 29 Nov 2020 14:51:13 -0500 (EST)

branch: externals/gnugo
commit 843cd963327ff977335346237f4db8a134eb7171
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>

    [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.
---
 gnugo.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 51fbbbe..43b54c5 100644
--- a/gnugo.el
+++ b/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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]