[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/01: [gnugo] Fix bug: Relax sync regexp.
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 01/01: [gnugo] Fix bug: Relax sync regexp. |
Date: |
Sun, 16 Feb 2014 22:44:10 +0000 |
ttn pushed a commit to branch ttn-gnugo
in repository elpa.
commit 65933f5ab0f0300113047f2f9349e79a98ba547e
Author: Thien-Thi Nguyen <address@hidden>
Date: Sun Feb 16 22:27:42 2014 +0100
[gnugo] Fix bug: Relax sync regexp.
* packages/gnugo/gnugo.el (gnugo-merge-showboard-results): ...here,
to handle certain increases in captured stones count.
---
packages/gnugo/ChangeLog | 7 +++++++
packages/gnugo/gnugo.el | 18 +++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/packages/gnugo/ChangeLog b/packages/gnugo/ChangeLog
index 2191eac..347cba8 100644
--- a/packages/gnugo/ChangeLog
+++ b/packages/gnugo/ChangeLog
@@ -1,3 +1,10 @@
+2014-02-16 Thien-Thi Nguyen <address@hidden>
+
+ [gnugo] Fix bug: Relax sync regexp.
+
+ * gnugo.el (gnugo-merge-showboard-results): ...here,
+ to handle certain increases in captured stones count.
+
2014-02-15 Thien-Thi Nguyen <address@hidden>
[gnugo int] Revamp gnugo-{put,get} doc / indentation decl.
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index f3c3b4f..9e813b7 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -534,7 +534,23 @@ a format string applied to the rest of the args."
(defun gnugo-merge-showboard-results ()
(let ((aft (substring (cdr (gnugo-synchronous-send/return "showboard")) 3))
(adj 1) ; string to buffer position adjustment
- (sync "[0-9]+ stones$")
+
+ (sync "[0-9]* stones$")
+ ;; Note: `sync' used to start w/ "[0-9]+", but that is too
+ ;; restrictive a condition that fails in the case of:
+ ;;
+ ;; (before)
+ ;; ... WHITE has captured 1 stones
+ ;; ^
+ ;; (after)
+ ;; ... WHITE has captured 14 stones
+ ;; ^
+ ;;
+ ;; where the after count has more digits than the before count,
+ ;; but shares the same leading digits. In this case, the result
+ ;; of `compare-strings' points to the SPC following the before
+ ;; count (indicated by caret in this example).
+
(bef (buffer-substring-no-properties (point-min) (point-max)))
(bef-start 0) (bef-idx 0)
(aft-start 0) (aft-idx 0)