[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo f3c90cd 187/357: [gnugo] Make ‘C-u F’ add the bl
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo f3c90cd 187/357: [gnugo] Make ‘C-u F’ add the blurb as a comment to the last node. |
Date: |
Sun, 29 Nov 2020 14:51:18 -0500 (EST) |
branch: externals/gnugo
commit f3c90cd6eed3fd11737d279789266f25aa1849e4
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo] Make ‘C-u F’ add the blurb as a comment to the last node.
* packages/gnugo/gnugo.el (gnugo-display-final-score):
...here, if new prefix arg COMMENT is set, with "territory",
"captures", "komi" squashed to "T", "C", "K", respectively.
---
NEWS | 1 +
gnugo.el | 22 +++++++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 12ef38d..1b7ab98 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ NB: "RCS: X..Y " means that the particular release includes
- dropped command: ‘t’ (gnugo-toggle-dead-group)
- PASS for SZ <= 19 normalized to "" on read, written as ""
- ‘=’ also displays move number of the stone (if any) at that position
+ - ‘C-u F’ adds the (abbreviated) blurb as a comment to the last node
- new keybinding for ‘gnugo-undo-one-move’: M-u
- ‘gnugo-undo-one-move’ can optionally arrange for you to play next
- new command: ‘C’ (gnugo-comment)
diff --git a/gnugo.el b/gnugo.el
index 632d2bf..fe19d80 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -1985,12 +1985,14 @@ Prefix arg means to redo all the undone moves."
(gnugo-refresh)
(redisplay)))))))))
-(defun gnugo-display-final-score ()
+(defun gnugo-display-final-score (&optional comment)
"Display final score and other info in another buffer (when game over).
If the game is still ongoing, Emacs asks if you wish to stop play (by
making sure two \"pass\" moves are played consecutively, if necessary).
-Also, add the `:RE' SGF property to the root node of the game tree."
- (interactive)
+Also, add the `:RE' SGF property to the root node of the game tree.
+Prefix arg COMMENT means to also attach the text (slightly compacted)
+to the last move, as a comment."
+ (interactive "P")
(let ((game-over (gnugo-get :game-over)))
(unless (or game-over
(and (not (gnugo-get :waiting))
@@ -2090,6 +2092,20 @@ Also, add the `:RE' SGF property to the root node of the
game tree."
(yep " end" end))))
(setq blurb (apply 'concat (nreverse blurb)))
(gnugo--set-root-prop :RE result)
+ (when comment
+ (let ((node (car (aref (gnugo-get :monkey) 0))))
+ (gnugo--decorate
+ (delq (assq :C node) node)
+ (with-temp-buffer
+ (insert blurb)
+ (cl-flet ((rep (old new)
+ (goto-char (point-min))
+ (while (search-forward old nil t)
+ (replace-match new))))
+ (rep "territory" "T")
+ (rep "captures" "C")
+ (rep "komi" "K"))
+ `((:C . ,(buffer-string)))))))
(switch-to-buffer (format "%s*GNUGO Final Score*" (gnugo-get :diamond)))
(erase-buffer)
(insert blurb)))
- [elpa] externals/gnugo de40b22 152/357: [gnugo int] Move vectorization into ‘gnugo--set-tree-ends’., (continued)
- [elpa] externals/gnugo de40b22 152/357: [gnugo int] Move vectorization into ‘gnugo--set-tree-ends’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e8833a9 161/357: [gnugo int] Fix syntax error in ‘loop’ destructuring., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3e3fbea 155/357: [gnugo sgf] Fix bug: Preserve whitespace for ‘text’ values., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0f3f4b6 165/357: [gnugo int] Use ‘ignore’ to avoid byte-compiler warnings., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 082d56c 178/357: [gnugo int] Use ‘gnugo--decorate’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e382633 190/357: [gnugo] Drop var: gnugo-inhibit-refresh, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo dd6b6f8 186/357: [gnugo] New command: ‘C’ (gnugo-comment), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo cba406b 176/357: [gnugo] Include root node in :sgf-gametree description., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1ac646f 172/357: [gnugo] New command: ‘O’ (gnugo-okay), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3f13bbf 168/357: [gnugo] Make ‘=’ also display move number., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f3c90cd 187/357: [gnugo] Make ‘C-u F’ add the blurb as a comment to the last node.,
Stefan Monnier <=
- [elpa] externals/gnugo bcc912b 164/357: [gnugo frolic int] Add var selection to awakening parameterization., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 66c29d0 197/357: [gnugo int] Add abstraction: gnugo--gate-game-over, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5bbec0e 179/357: [gnugo int] Incorporate ‘gnugo-note’ into unique caller., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 82b6000 198/357: [gnugo] Mention ‘gnugo-frolic-mode-hook’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 32e8547 199/357: [gnugo int] Add abstraction: gnugo--user-play, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 001228c 205/357: [gnugo] Drop support for ‘(gnugo-move-history 'count)’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 106a279 211/357: [gnugo int] Consolidate paren overlays access., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 17d907d 210/357: [gnugo int] Shave one ‘gnugo-other’ call., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1d6b241 214/357: [gnugo] Use ‘define-derived-mode’ for GNUGO Board mode., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 167ba89 213/357: [gnugo int] Decruft: Streamline game-over handling on SGF load., Stefan Monnier, 2020/11/29