[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 19309c3 139/357: [gnugo frolic] Handle invalid br
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 19309c3 139/357: [gnugo frolic] Handle invalid branch more consistently. |
Date: |
Sun, 29 Nov 2020 14:51:07 -0500 (EST) |
branch: externals/gnugo
commit 19309c3c8c507974e6a2621cc65f78c67cc7148c
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo frolic] Handle invalid branch more consistently.
* packages/gnugo/gnugo.el (gnugo--awake):
If ‘col’ is too big or too small, return nil for ‘a’.
(gnugo--swiz, gnugo-frolic-prune-branch):
Throw error on invalid branch.
(gnugo-frolic-backward-branch): Take invalid branch as ‘width’.
(gnugo-frolic-forward-branch): Take invalid branch as -1.
---
gnugo.el | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index 8495bb3..ea37ef1 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -939,10 +939,11 @@ are dimmed. Type \\[describe-mode] in that buffer for
details."
(col (current-column)))
(values tree ends width
monkey (aref monkey 1)
- line col (if (> 10 col)
- -1
- (/ (- col 10)
- 6)))))
+ line col (unless (> 10 col)
+ (let ((try (/ (- col 10)
+ 6)))
+ (unless (<= width try)
+ try))))))
(defmacro gnugo--awakened (&rest body)
`(multiple-value-bind (tree ends width
@@ -954,8 +955,8 @@ are dimmed. Type \\[describe-mode] in that buffer for
details."
(defun gnugo--swiz (direction &optional blunt)
(gnugo--awakened
- (when (> 0 a)
- (setq a bidx))
+ (unless a
+ (user-error "No branch here"))
(let* ((b (cond ((numberp blunt)
(unless (and (< -1 blunt)
(< blunt width))
@@ -1014,6 +1015,8 @@ This fails if the monkey is on the current branch
\(a restriction that will probably be lifted Real Soon Now\)."
(interactive)
(gnugo--awakened
+ (unless a
+ (user-error "No branch here"))
;; todo: define meaningful eviction semantics; remove restriction
(when (= a bidx)
(user-error "Cannot prune with monkey on branch"))
@@ -1043,13 +1046,13 @@ This fails if the monkey is on the current branch
"Move backward N (default 1) branches."
(interactive "p")
(gnugo--awakened
- (move-to-column (+ 10 (* 6 (mod (- a n) width))))))
+ (move-to-column (+ 10 (* 6 (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 (+ a n) width))))))
+ (move-to-column (+ 10 (* 6 (mod (+ (or a -1) n) width))))))
(defun gnugo-boss-is-near ()
"Do `bury-buffer' until the current one is not a GNU Board."
- [elpa] externals/gnugo 0f9f540 125/357: [gnugo int] Maintain tree MNUM., (continued)
- [elpa] externals/gnugo 0f9f540 125/357: [gnugo int] Maintain tree MNUM., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7211950 346/357: [gnugo] Indicate seki groups on the board., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 35c4645 347/357: [gnugo] Make ‘C-u F’ store additional SGF properties., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0c4b37b 349/357: [gnugo] Document new ‘C-u F’ behavior., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e66bfa0 352/357: [gnugo int] Gate ‘cursor-intangible-mode’ call precisely, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 2f73382 353/357: [gnugo] Add some docstrings to some vars/funcs., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo eb9748f 355/357: [gnugo maint] Update years in copyright notice; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 2dd0aca 357/357: * .gitignore: New file, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo ee905ef 048/357: [gnugo] Fix bug: Compute grid spacing using offset math., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 566623c 121/357: [gnugo int] Invert ‘if’ CONDITION and THEN/ELSE clauses., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 19309c3 139/357: [gnugo frolic] Handle invalid branch more consistently.,
Stefan Monnier <=
- [elpa] externals/gnugo d214e7e 137/357: [gnugo frolic] Add command to set the main line., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo dd42857 148/357: [gnugo frolic] Set ‘truncate-lines’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1a544a5 154/357: [gnugo int] Whitespace munging; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 89d10e4 159/357: [gnugo int] Reorder gametree IR: ENDS, MNUM, ROOT, KIDS., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bba08d3 158/357: [gnugo sgf int] Internalize ‘gnugo/sgf-hang-from-root’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 2f09438 145/357: [gnugo int] Fix syntax error., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0eede2a 175/357: [gnugo int] Add abstraction: gnugo--count-query, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 8a064c5 184/357: [gnugo int] Incorporate *-play-stone into ‘gnugo-push-move’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo ee09531 192/357: [gnugo] New command: ‘S’ (gnugo-request-suggestion), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bc92d6d 202/357: [gnugo frolic] Type ‘Q’ to quit., Stefan Monnier, 2020/11/29