[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo e96b88b 218/357: [gnugo] Decruft: Use ‘gnugo-pro
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo e96b88b 218/357: [gnugo] Decruft: Use ‘gnugo-program’ directly as executable. |
Date: |
Sun, 29 Nov 2020 14:51:25 -0500 (EST) |
branch: externals/gnugo
commit e96b88bac96f43d4422bd0f3fc5357036ce9d8de
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo] Decruft: Use ‘gnugo-program’ directly as executable.
* packages/gnugo/gnugo.el (gnugo-program): Rewrite docstring.
(gnugo): Add ‘gnugo-program’ sanity check prior to buffer
switch; drop support for "PROGRAM OPTIONS..." value.
---
NEWS | 1 +
gnugo.el | 36 ++++++++++++------------------------
2 files changed, 13 insertions(+), 24 deletions(-)
diff --git a/NEWS b/NEWS
index c2da1c4..b803fd9 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ NB: "RCS: X..Y " means that the particular release includes
- avoid clobbering SGF property ‘EV’ on resignation
- follow main line in subtrees on read
- for ‘F’ forced PASS moves, keep subproc informed as well
+ - dropped support for ‘gnugo-program’ of form "PROGRAM OPTIONS..."
- dropped command: ‘t’ (gnugo-toggle-dead-group)
- PASS for SZ <= 19 normalized to "" on read, written as ""
- ‘=’ also displays move number of the stone (if any) at that position
diff --git a/gnugo.el b/gnugo.el
index be114cd..b1de724 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -94,14 +94,12 @@ This follows a MAJOR.MINOR.PATCH scheme.")
;;; Variables for the uninquisitive programmer
(defvar gnugo-program "gnugo"
- "Command to start an external program that speaks GTP, such as \"gnugo\".
-The value may also be in the form \"PROGRAM OPTIONS...\" in which case the
-the command `gnugo' will prefix OPTIONS in its default offering when it
-queries you for additional options. It is an error for \"--mode\" to appear
-in OPTIONS.
-
-For more information on GTP and GNU Go, feel free to visit:
-http://www.gnu.org/software/gnugo")
+ "Name of the GNU Go program (executable file).
+\\[gnugo] validates this using `executable-find'.
+This program must accept command line args:
+ --mode gtp --quiet
+For more information on GTP and GNU Go, please visit:
+<http://www.gnu.org/software/gnugo>")
(defvar gnugo-board-mode-map nil
"Keymap for GNUGO Board mode.")
@@ -2431,24 +2429,13 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
(if (string= "" sel)
(car all)
(assoc sel all))))))
+ ;; sanity check
+ (unless (executable-find gnugo-program)
+ (user-error "Invalid `gnugo-program': %S" gnugo-program))
;; set up a new board
(switch-to-buffer (generate-new-buffer "(Uninitialized GNUGO Board)"))
(gnugo-board-mode)
- (let ((name (if (string-match "[ ]" gnugo-program)
- (let ((p (substring gnugo-program 0 (match-beginning 0)))
- (o (substring gnugo-program (match-end 0)))
- (h (or (car gnugo-option-history) "")))
- (when (string-match "--mode" o)
- (user-error "Found \"--mode\" in `gnugo-program'"))
- (when (and o (cl-plusp (length o))
- h (cl-plusp (length o))
- (or (< (length h) (length o))
- (not (string= (substring h 0 (length o))
- o))))
- (push (concat o " " h) gnugo-option-history))
- p)
- gnugo-program))
- (args (read-string "GNU Go options: "
+ (let ((args (read-string "GNU Go options: "
(car gnugo-option-history)
'gnugo-option-history))
proc
@@ -2471,7 +2458,8 @@ starting a new one. See `gnugo-board-mode' documentation
for more info."
(let ((proc-args (split-string args)))
(gnugo-put :proc-args proc-args)
(gnugo-put :proc (setq proc (apply 'start-process "gnugo"
- (current-buffer) name
+ (current-buffer)
+ gnugo-program
"--mode" "gtp" "--quiet"
proc-args))))
(set-process-sentinel proc 'gnugo-sentinel)
- [elpa] externals/gnugo 66c29d0 197/357: [gnugo int] Add abstraction: gnugo--gate-game-over, (continued)
- [elpa] externals/gnugo 66c29d0 197/357: [gnugo int] Add abstraction: gnugo--gate-game-over, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5bbec0e 179/357: [gnugo int] Incorporate ‘gnugo-note’ into unique caller., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 82b6000 198/357: [gnugo] Mention ‘gnugo-frolic-mode-hook’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 32e8547 199/357: [gnugo int] Add abstraction: gnugo--user-play, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 001228c 205/357: [gnugo] Drop support for ‘(gnugo-move-history 'count)’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 106a279 211/357: [gnugo int] Consolidate paren overlays access., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 17d907d 210/357: [gnugo int] Shave one ‘gnugo-other’ call., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1d6b241 214/357: [gnugo] Use ‘define-derived-mode’ for GNUGO Board mode., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 167ba89 213/357: [gnugo int] Decruft: Streamline game-over handling on SGF load., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b3d3da0 220/357: [gnugo int] Use functional style more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e96b88b 218/357: [gnugo] Decruft: Use ‘gnugo-program’ directly as executable.,
Stefan Monnier <=
- [elpa] externals/gnugo 3670b0b 228/357: [gnugo] On SGF load, leave cursor at last user board position., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1020a7f 237/357: [gnugo int] Simplify towards-root loop termination check., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7114ed6 234/357: [gnugo int] Add abstraction: gnugo--mem-with-played-stone, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 9ae1363 236/357: [gnugo] Internalize ‘gnugo-magic-undo’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a92e184 255/357: fixup! [gnugo int] Decorate w/ plist instead of alist., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 71e1500 245/357: [gnugo] Fix bug: Use ‘gnugo-gate’ for abdication enable., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 46f49e3 246/357: [gnugo int] Use ‘gnugo-current-player’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 443903e 249/357: [gnugo int] Drop abstraction: pretty, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a0ecdea 257/357: [gnugo] Conditionalize xform warping on abdication disable., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 85e3d91 253/357: [gnugo int] Snoop ‘--handicap N’ for empty new board., Stefan Monnier, 2020/11/29