]> code.delx.au - gnu-emacs-elpa/commitdiff
[gnugo] New command: ‘A’ (gnugo-switch-to-another)
authorThien-Thi Nguyen <ttn@gnu.org>
Fri, 21 Feb 2014 11:47:18 +0000 (12:47 +0100)
committerThien-Thi Nguyen <ttn@gnu.org>
Mon, 24 Feb 2014 12:31:50 +0000 (13:31 +0100)
* packages/gnugo/gnugo.el
(gnugo-switch-to-another): New command.
(gnugo-board-mode-map): Bind ‘A’ to it.

packages/gnugo/gnugo.el

index b30988cb71e58461bfc978545d49738b5ce84685..7fc1e23362244bd5a97000792d6965ba279ded50 100644 (file)
@@ -1554,6 +1554,15 @@ which placed the stone at point."
   (interactive)
   (message "%s" (gnugo-position)))
 
+(defun gnugo-switch-to-another ()
+  "Switch to another GNU Go game buffer (if any)."
+  (interactive)
+  (let ((cur (current-buffer)))
+    (switch-to-buffer (cl-find-if 'gnugo-board-buffer-p
+                                  (reverse (buffer-list))))
+    (when (eq cur (current-buffer))
+      (message "(only one)"))))
+
 ;;;---------------------------------------------------------------------------
 ;;; Command properties and gnugo-command
 
@@ -1834,6 +1843,7 @@ starting a new one.  See `gnugo-board-mode' documentation for more info."
           ("\C-x\C-w" . gnugo-write-sgf-file)
           ("l"        . gnugo-read-sgf-file)
           ("F"        . gnugo-display-final-score)
+          ("A"        . gnugo-switch-to-another)
           ;; mouse
           ([(down-mouse-1)] . gnugo-mouse-move)
           ([(down-mouse-2)] . gnugo-mouse-move) ; mitigate accidents