[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 57a9ecc 1/4: [gnugo] Add some docstrings to some vars/func
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] master 57a9ecc 1/4: [gnugo] Add some docstrings to some vars/funcs. |
Date: |
Sat, 24 Oct 2020 13:48:44 -0400 (EDT) |
branch: master
commit 57a9ecc9a6b0ee6e2421029e79b254c1cbc49c96
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo] Add some docstrings to some vars/funcs.
* packages/gnugo/gnugo.el (gnugo-option-history): Add docstring.
(gnugo-other, gnugo-lsquery, gnugo-yang, gnugo-yy): Likewise.
---
packages/gnugo/gnugo.el | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index abc4970..b605d9c 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -204,7 +204,8 @@ list of forms.")
("O" . gnugo-O-face))
"Font lock keywords for `gnugo-board-mode'.")
-(defvar gnugo-option-history nil)
+(defvar gnugo-option-history nil
+ "History list of options for `gnugo' invocation.")
(defvar gnugo-state nil) ; hint: C-c C-p
@@ -386,6 +387,7 @@ Handle the big, slow-to-render, and/or uninteresting ones
specially."
(string= "black" string))
(defun gnugo-other (color)
+ "If COLOR is \"black\", return \"white\", otherwise \"black\"."
(if (gnugo--blackp color) "white" "black"))
(defun gnugo-current-player ()
@@ -486,6 +488,7 @@ when you are sure the command cannot fail."
(string-to-number (gnugo-query cmd)))
(defun gnugo-lsquery (message-format &rest args)
+ "Apply `gnugo-query' to args; split its rv (return list of strings)."
(split-string (apply 'gnugo-query message-format args)))
(defsubst gnugo--count-query (fmt &rest args)
@@ -524,12 +527,33 @@ Return final buffer position (i.e., point)."
(gnugo-get :obarray)))
(defun gnugo-yang (c)
+ "Return the \"image type information\" corresponding to character C.
+C is one of the four characters used in the ASCII representation
+of a game board -- ?+ (U+2B PLUS SIGN), ?. (U+2E FULL STOP), ?X
+and ?O (U+58 and U+4F, LATIN CAPITAL LETTER X and O, respectively).
+For example, here is a 5x5 board with two stones placed:
+
+ . . . . .
+ . O . + . (white at B4)
+ . . + . .
+ . + . + X (black at E2)
+ . . . . .
+
+The image type information consists of a single symbol for ?. and ?+
+and a pair (SANS-POINT . WITH-POINT) for ?X and ?O. Both SANS-POINT
+and WITH-POINT are symbols. For other C, return nil."
(gnugo-aqr c '((?+ . hoshi)
(?. . empty)
(?X . (bmoku . bpmoku))
(?O . (wmoku . wpmoku)))))
(defun gnugo-yy (yin yang &optional momentaryp)
+ "Return a symbol made by formatting YIN (an integer) and YANG.
+The returned symbol has the format N-SYMBOL.
+
+If YANG is a symbol, use it directly. Otherwise, YANG must be a pair.
+If optional arg MOMENTARYP is non-nil, use the `cdr' of YANG.
+Otherwise, use the `car' of YANG. See `gnugo-yang'."
(gnugo-f (format "%d-%s"
yin (cond ((symbolp yang) yang)
(momentaryp (cdr yang))