Function: klabel-type:set-legal
klabel-type:set-legal is a byte-compiled function defined in
klabel.el.
Signature
(klabel-type:set-legal CURRENT-CELL-LABEL LBL-SEP-LEN CURRENT-INDENT PER-LEVEL-INDENT &optional CURRENT-TREE-ONLY)
Documentation
Set the labels of current cell, its following siblings and their subtrees.
CURRENT-CELL-LABEL is the label to display for the current cell. LBL-SEP-LEN is the length of the separation between a cell's label and the start of its contents.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/klabel.el
(defun klabel-type:set-legal (current-cell-label lbl-sep-len current-indent
per-level-indent &optional current-tree-only)
"Set the labels of current cell, its following siblings and their subtrees.
CURRENT-CELL-LABEL is the label to display for the current cell.
LBL-SEP-LEN is the length of the separation between a cell's label
and the start of its contents."
(let (label-prefix label-suffix suffix-val opoint)
(if current-cell-label
(setq label-suffix (klabel:to-kotl-label current-cell-label)
label-prefix (substring current-cell-label
0 (- (length label-suffix)))
suffix-val (string-to-number label-suffix)))
(while current-cell-label
;; Set current cell's label.
(klabel:set current-cell-label lbl-sep-len)
;; Process any subtrees of current cell.
(if (kcell-view:child nil lbl-sep-len)
;; Recurse over subtree.
(klabel-type:set-legal
(klabel:child-legal current-cell-label)
lbl-sep-len
(+ current-indent per-level-indent)
per-level-indent))
;; Process next sibling of current cell if any.
(setq opoint (point))
(if (and (not current-tree-only)
(kcell-view:next nil lbl-sep-len)
(< (abs (- (kcell-view:indent nil lbl-sep-len) current-indent))
(kview:level-indent kotl-kview)))
(setq suffix-val (1+ suffix-val)
label-suffix (int-to-string suffix-val)
current-cell-label (concat label-prefix label-suffix))
(goto-char opoint)
(setq current-cell-label nil)))))