Function: gametree-break-line-here

gametree-break-line-here is an interactive and byte-compiled function defined in gametree.el.gz.

Signature

(gametree-break-line-here &optional AT-MOVE)

Documentation

Split the variation node at the point position.

This command works whether the current variation node is a leaf, or is already branching at its end. The new node is created at a level that reflects the number of game plies between the beginning of the current variation and the breaking point.

With a numerical argument AT-MOVE, split the variation before White's AT-MOVEth move, or Black's if negative. The last option will only work of Black's moves are explicitly numbered, for instance
1. e4 1: e5.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/play/gametree.el.gz
(defun gametree-break-line-here (&optional at-move)
  "Split the variation node at the point position.
This command works whether the current variation node is a leaf, or is
already branching at its end.  The new node is created at a level that
reflects the number of game plies between the beginning of the current
variation and the breaking point.

With a numerical argument AT-MOVE, split the variation before
White's AT-MOVEth move, or Black's if negative.  The last option will
only work of Black's moves are explicitly numbered, for instance
`1. e4 1: e5'."
  (interactive "*P")
  (if at-move (progn
          (end-of-line 1)
          (let ((limit (point)))
            (beginning-of-line 1)
            (re-search-forward
             (concat
              (regexp-quote
               (int-to-string (abs (prefix-numeric-value at-move))))
              (if (> at-move 0) gametree-full-ply-regexp
                gametree-half-ply-regexp)) limit))
          (goto-char (match-beginning 0))))
  (gametree-transpose-following-leaves)
  (let* ((pt (point-marker))
         (plies (gametree-current-branch-ply))
         (depth (gametree-current-branch-depth))
         (old-depth depth))
    (if (= depth 0)
        (progn
          (save-excursion
            (outline-previous-visible-heading 1)
            (setq depth
                  (let ((old-branch-ply
                         (condition-case nil
                             (gametree-current-branch-ply)
                           (error 0))))
                    (if (zerop old-branch-ply)
                        (1+ (gametree-current-branch-depth))
                      (+ (gametree-current-branch-depth)
                         (- plies old-branch-ply))))))
          (save-excursion
            (beginning-of-line 1)
            (funcall gametree-make-heading-function depth)
            (gametree-prettify-heading))))
    (save-excursion
      (if (not (looking-at (concat "[ \t]*[1-9][0-9]*\\("
                                   gametree-full-ply-regexp "\\|"
                                   gametree-half-ply-regexp "\\)")))
          (progn
            (insert (format (if (= 0 (mod (gametree-looking-at-ply) 2))
                                gametree-full-ply-format
                              gametree-half-ply-format)
                            (/ (gametree-looking-at-ply) 2)))
            (gametree-prettify-heading)
            (beginning-of-line 1)))
      (goto-char pt)
      (insert "\n")
      (if (not (= 0 old-depth))
          (funcall gametree-make-heading-function
                   (+ depth (- (gametree-current-branch-ply) plies))))
      (gametree-prettify-heading))))