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

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

[elpa] externals/gnugo 2bde4bc 207/357: [gnugo] Add hook: gnugo-start-ga


From: Stefan Monnier
Subject: [elpa] externals/gnugo 2bde4bc 207/357: [gnugo] Add hook: gnugo-start-game-hook
Date: Sun, 29 Nov 2020 14:51:23 -0500 (EST)

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

    [gnugo] Add hook: gnugo-start-game-hook
    
    * packages/gnugo/gnugo.el (gnugo-start-game-hook): New var.
    (gnugo): Run ‘gnugo-start-game-hook’.
---
 NEWS     | 1 +
 gnugo.el | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/NEWS b/NEWS
index 98ee291..99966a1 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,7 @@ NB: "RCS: X..Y " means that the particular release includes
     - ‘gnugo-magic-undo’ handles SPEC ‘0’
     - dropped ‘(gnugo-move-history 'count)’ (BI)
     - new func: ‘gnugo-current-player’
+    - new hook: ‘gnugo-start-game-hook’
 
 - 2.3.1 | 2014-02-27
   - portability fixes
diff --git a/gnugo.el b/gnugo.el
index 59db6dd..e7a3851 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -69,6 +69,7 @@
 ;;                    `gnugo-xpms'
 ;;   normal hooks:    `gnugo-board-mode-hook'
 ;;                    `gnugo-frolic-mode-hook'
+;;                    `gnugo-start-game-hook'
 ;;                    `gnugo-post-move-hook'
 ;;   and the keymap:  `gnugo-board-mode-map'
 ;;
@@ -111,6 +112,11 @@ http://www.gnu.org/software/gnugo";)
 (defvar gnugo-board-mode-hook nil
   "Hook run when entering GNUGO Board mode.")
 
+(defvar gnugo-start-game-hook nil
+  "Normal hook run immediately before the first move of the game.
+To find out who is to move first, use `gnugo-current-player'.
+See also `gnugo-board-mode'.")
+
 (defvar gnugo-post-move-hook nil
   "Normal hook run after a move and before the board is refreshed.
 Initially, when `run-hooks' is called, the current buffer is the GNUGO
@@ -2555,6 +2561,7 @@ starting a new one.  See `gnugo-board-mode' documentation 
for more info."
                   (and (gnugo--blackp g) (< n 2)))
               u
             g))
+        (run-hooks 'gnugo-start-game-hook)
         (when (string= g (gnugo-current-player))
           (gnugo-refresh t)
           (gnugo-get-move g))))))



reply via email to

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