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

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

[elpa] externals/gnugo 53da06f 329/357: [gnugo] Make ‘gnugo-comment’ fa


From: Stefan Monnier
Subject: [elpa] externals/gnugo 53da06f 329/357: [gnugo] Make ‘gnugo-comment’ fall back to root node.
Date: Sun, 29 Nov 2020 14:51:50 -0500 (EST)

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

    [gnugo] Make ‘gnugo-comment’ fall back to root node.
    
    * packages/gnugo/gnugo.el (gnugo-comment): Interactively,
    no longer signal ‘user-error’ if there is no played
    stone at point; instead, take NODE to be the root node.
---
 gnugo.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 3bfee65..9dd0b61 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -2015,17 +2015,20 @@ If there a stone at that position, also display its 
move number."
 
 (defun gnugo-comment (node comment)
   "Add to NODE a COMMENT (string) property.
-Called interactively, NODE is the one corresponding to the
-stone at point, and any previous comment is inserted as the
-initial-input (see `read-string').
+Interactively, NODE is the one corresponding to the stone at point,
+or the root node if there is no played stone at point, and any
+previous comment is inserted as the initial-input (see `read-string').
 
 If COMMENT is nil or the empty string, remove the property entirely."
   (interactive
    (let* ((pos (gnugo-position))
-          (node (gnugo--node-with-played-stone pos)))
+          (node (or (gnugo--node-with-played-stone pos t)
+                    (gnugo--root-node))))
      (list node
            (read-string (format "Comment for %s: "
-                                (gnugo-describe-position))
+                                (if (eq node (gnugo--root-node))
+                                    "root node"
+                                  (gnugo-describe-position)))
                         (cdr (assq :C node))))))
   (setq node (delq (assq :C node) node))
   (unless (zerop (length comment))



reply via email to

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