gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] gnugo.el 1.19


From: Thien-Thi Nguyen
Subject: Re: [gnugo-devel] gnugo.el 1.19
Date: Wed, 08 Jan 2003 16:54:39 -0800

   From: Paul Pogonyshev <address@hidden>
   Date: Thu, 9 Jan 2003 01:49:35 +0200

   "gnugo command output" buffer jumping out each time

ok.  for some gtp commands this is appropriate behavior but obviously
not for all.  could you try the patch below?  it adds variable
`gnugo-command-output' which controls things on a per-command basis, and
fixes the bug whereby no command given "hangs" gnugo.el.  suggestions on
which commands belong in which categories (including default) welcome.

   [handicap setting suggestions]

thanks for the detailed user scenarios.  i'll mull over the
implementation implications and see what bubbles up...

thi


______________________________________________
cd /home/ttn/build/pe/lisp/diversions/
rcsdiff -c gnugo.el
===================================================================
RCS file: RCS/gnugo.el,v
retrieving revision 1.19
diff -c -r1.19 gnugo.el
*** gnugo.el    2002/12/28 03:15:50     1.19
--- gnugo.el    2003/01/09 00:39:26
***************
*** 52,57 ****
--- 52,67 ----
  character in the string, then the next, and so on until the string (and/or
  the viewer) is exhausted.")
  
+ (defvar gnugo-command-output '()
+   "Assoc list describing how to handle output of `M-x gnugo-command'.
+ If a command is not here, the default behavior is to switch to a
+ separate buffer to show the output of the command (if any).
+ 
+ Keys are symbols, values are one of the following symbols:
+   message -- show output in minibuffer
+   discard -- discard output
+   refresh -- redraw the board")
+ 
  ;;;---------------------------------------------------------------------------
  ;;; Support functions
  
***************
*** 448,459 ****
    "During a GNU Go game, send Go Text Protocol COMMAND to the subprocess.
  Display output to buffer *gnugo command output* and switch to there."
    (interactive "sCommand: ")
!   (message "Doing %s ..." command)
!   (let ((data (cdr (gnugo-synchronous-send/return command))))
!     (switch-to-buffer "*gnugo command output*")
!     (erase-buffer)
!     (insert data))
!   (message "Doing %s ... done." command))
  
  ;;;---------------------------------------------------------------------------
  ;;; Entry point
--- 458,479 ----
    "During a GNU Go game, send Go Text Protocol COMMAND to the subprocess.
  Display output to buffer *gnugo command output* and switch to there."
    (interactive "sCommand: ")
!   (if (string= "" command)
!       (message "(no command given)")
!     (message "Doing %s ..." command)
!     (let ((data (cdr (gnugo-synchronous-send/return command)))
!           (where (cdr (assq (intern (car (split-string command)))
!                             gnugo-command-output))))
!       (if (or (eq 'message where)
!               (string-match "unknown.command" data))
!           (message "%s" data)
!         (case where
!           ((discard) t)
!           ((refresh) (gnugo-showboard))
!           (t (switch-to-buffer "*gnugo command output*")
!              (erase-buffer)
!              (insert data)))
!         (message "Doing %s ... done." command)))))
  
  ;;;---------------------------------------------------------------------------
  ;;; Entry point
***************
*** 557,562 ****
--- 577,598 ----
              ;; mouse
              ([(down-mouse-1)] . gnugo-mouse-move)
              ([(down-mouse-3)] . gnugo-mouse-pass))))
+ 
+ (unless gnugo-command-output
+   (setq gnugo-command-output
+         (append
+          (mapcar '(lambda (command) (cons command 'message))
+                  '(;; Add more message commands here.
+                    captures
+                    is_legal
+                    version))
+          (mapcar '(lambda (command) (cons command 'discard))
+                  '(;; Add more discard commands here.
+                    ))
+          (mapcar '(lambda (command) (cons command 'refresh))
+                  '(;; Add more refresh commands here.
+                    clear_board
+                    handicap)))))
  
  (provide 'gnugo)
  

Compilation exited abnormally with code 1 at Wed Jan  8 16:39:28




reply via email to

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