eschulte pushed a commit to branch go in repository elpa. commit 6ea0389dcc00c9a3cec776aaf4b2f9a0406208fc Author: Eric Schulte <eric.schu...@gmx.com> Date: Sat May 26 16:46:00 2012 -0600
single function to play gnugo --- go-board.el | 7 +++++++ go-gnugo.el | 8 +++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/go-board.el b/go-board.el index b13b273..c1e4c02 100644 --- a/go-board.el +++ b/go-board.el @@ -304,4 +304,11 @@ (define-derived-mode go-board-mode nil "GO" "Major mode for viewing a GO board.") +(defun go-board-play (&optional level) + (interactive "P") + (go-board-display + (make-instance 'gnugo + :buffer (apply #'go-gnugo-start-process + (when level (list "--level" (number-to-string level))))))) + (provide 'go-board) diff --git a/go-gnugo.el b/go-gnugo.el index fa70a1e..738a45b 100644 --- a/go-gnugo.el +++ b/go-gnugo.el @@ -48,12 +48,12 @@ (defvar go-gnugo-process-name "gnugo" "name for the gnugo process") -(defun go-gnugo-start-process (&optional options) +(defun go-gnugo-start-process (&rest options) (let ((buffer (apply 'make-comint go-gnugo-process-name go-gnugo-program nil "--mode" "gtp" "--quiet" - (when options (split-string options))))) + options))) (with-current-buffer buffer (comint-mode)) buffer)) @@ -89,9 +89,7 @@ ;;; Class and interface (defclass gnugo (gtp) - ((buffer :initarg :buffer - :accessor buffer - :initform (go-gnugo-start-process)))) + ((buffer :initarg :buffer :accessor buffer :initform nil))) (defmethod gtp-command ((gnugo gnugo) command) (go-gnugo-command-to-string gnugo command))