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

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

[elpa] externals/gnugo 74ff909 038/357: [gnugo] Fix bug: Relax sync rege


From: Stefan Monnier
Subject: [elpa] externals/gnugo 74ff909 038/357: [gnugo] Fix bug: Relax sync regexp.
Date: Sun, 29 Nov 2020 14:50:43 -0500 (EST)

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

    [gnugo] Fix bug: Relax sync regexp.
    
    * packages/gnugo/gnugo.el (gnugo-merge-showboard-results): ...here,
    to handle certain increases in captured stones count.
---
 gnugo.el | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/gnugo.el b/gnugo.el
index f3c3b4f..9e813b7 100644
--- a/gnugo.el
+++ b/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)



reply via email to

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