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

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

[elpa] master 3dbc841 2/2: [gnugo] Make ‘gnugo-comment’ fall back to ro


From: Thien-Thi Nguyen
Subject: [elpa] master 3dbc841 2/2: [gnugo] Make ‘gnugo-comment’ fall back to root node.
Date: Mon, 6 Feb 2017 22:38:40 +0000 (UTC)

branch: master
commit 3dbc8417c89628cfbfcc21f265da6a65b0bf1c5e
Author: Thien-Thi Nguyen <address@hidden>
Commit: Thien-Thi Nguyen <address@hidden>

    [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.
---
 packages/gnugo/gnugo.el |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 3bfee65..9dd0b61 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/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]