[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/07: [gnugo frolic] Add command to set the main line.
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 01/07: [gnugo frolic] Add command to set the main line. |
Date: |
Wed, 09 Apr 2014 06:34:51 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit c9a0023931dea45b7d85b5fe64c97989c6659fae
Author: Thien-Thi Nguyen <address@hidden>
Date: Tue Apr 8 15:41:55 2014 +0200
[gnugo frolic] Add command to set the main line.
* packages/gnugo/gnugo.el (gnugo--swiz): Rename arg SHIFT to BLUNT;
if BLUNT is a number, validate and take it as ‘b’ directly.
(gnugo-frolic-set-as-main-line): New command.
(gnugo-frolic-mode-map): Bind ‘C-m’ to it.
---
packages/gnugo/gnugo.el | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 592fbc7..b49841b 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -952,12 +952,17 @@ are dimmed. Type \\[describe-mode] in that buffer for
details."
(gnugo--awake)
,@body))
-(defun gnugo--swiz (direction &optional shift)
+(defun gnugo--swiz (direction &optional blunt)
(gnugo--awakened
(when (> 0 a)
(setq a bidx))
- (let* ((b (mod (+ direction a) width))
- (flit (if shift (lambda (n)
+ (let* ((b (cond ((numberp blunt)
+ (unless (and (< -1 blunt)
+ (< blunt width))
+ (user-error "No such branch: %s" blunt))
+ blunt)
+ (t (mod (+ direction a) width))))
+ (flit (if blunt (lambda (n)
(cond ((= n a) b)
((= n b) a)
(t n)))
@@ -997,6 +1002,11 @@ are dimmed. Type \\[describe-mode] in that buffer for
details."
(interactive)
(gnugo--swiz 1))
+(defun gnugo-frolic-set-as-main-line ()
+ "Make the current branch the main line."
+ (interactive)
+ (gnugo--swiz nil 0))
+
(defun gnugo-frolic-backward-branch (&optional n)
"Move backward N (default 1) branches."
(interactive "p")
@@ -2271,6 +2281,7 @@ starting a new one. See `gnugo-board-mode' documentation
for more info."
("J" . gnugo-frolic-rotate-left)
("k" . gnugo-frolic-exchange-right)
("K" . gnugo-frolic-rotate-right)
+ ("\C-m" . gnugo-frolic-set-as-main-line)
("o" . gnugo-frolic-return-to-origin)))
(unless gnugo-board-mode-map
- [elpa] branch master updated (bbdff36 -> cc5eff1), Thien-Thi Nguyen, 2014/04/09
- [elpa] 02/07: [gnugo frolic] Add command to prune a branch., Thien-Thi Nguyen, 2014/04/09
- [elpa] 03/07: [gnugo frolic] Handle invalid branch more consistently., Thien-Thi Nguyen, 2014/04/09
- [elpa] 04/07: [gnugo frolic int] Assign ‘pop’ rv to avoid byte-compiler warning., Thien-Thi Nguyen, 2014/04/09
- [elpa] 05/07: [gnugo frolic int] Use ‘move-to-column’ more., Thien-Thi Nguyen, 2014/04/09
- [elpa] 06/07: [gnugo frolic int] Don't go through ‘gnugo-frolic-quit’ for refresh., Thien-Thi Nguyen, 2014/04/09
- [elpa] 07/07: [gnugo int] Fix bug: Unbreak SGF file output., Thien-Thi Nguyen, 2014/04/09
- [elpa] 01/07: [gnugo frolic] Add command to set the main line.,
Thien-Thi Nguyen <=