Function: gametree-insert-new-leaf
gametree-insert-new-leaf is an interactive and byte-compiled function
defined in gametree.el.gz.
Signature
(gametree-insert-new-leaf &optional AT-DEPTH)
Documentation
Start a new leaf variation under the current branching point.
The new variation can later be split to be a branching point itself,
with M-x gametree-break-line-here (gametree-break-line-here). If the point is currently on a
leaf variation, this command won't work; use M-x gametree-break-line-here (gametree-break-line-here)
on the current line first.
With a numeric arg AT-DEPTH, first go up the tree until a node of depth AT-DEPTH or smaller is found.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/play/gametree.el.gz
;;;; Commands
(defun gametree-insert-new-leaf (&optional at-depth)
"Start a new leaf variation under the current branching point.
The new variation can later be split to be a branching point itself,
with \\[gametree-break-line-here]. If the point is currently on a
leaf variation, this command won't work; use \\[gametree-break-line-here]
on the current line first.
With a numeric arg AT-DEPTH, first go up the tree until a node of
depth AT-DEPTH or smaller is found."
(interactive "*P")
(if (zerop (gametree-current-branch-depth))
(outline-up-heading 0))
(if at-depth
(while (> (gametree-current-branch-depth)
(prefix-numeric-value at-depth))
(outline-up-heading 1)))
(beginning-of-line 1)
(let ((parent-depth (gametree-current-branch-depth)))
(outline-show-entry)
(condition-case nil
(outline-next-visible-heading 1)
(error
(goto-char (point-max))
(if (not (bolp)) (insert "\n"))))
(let ((starting-plies
(if (> (gametree-current-branch-depth) parent-depth)
(gametree-current-branch-ply)
(save-excursion (forward-line -1)
(gametree-current-branch-ply)))))
(goto-char (1- (point)))
(insert "\n")
(insert (format (if (evenp starting-plies)
gametree-full-ply-format
gametree-half-ply-format)
(/ starting-plies 2))))))