Function: klabel-type:legal-label
klabel-type:legal-label is a byte-compiled function defined in
klabel.el.
Signature
(klabel-type:legal-label PREV-LABEL &optional CHILD-P)
Documentation
Return full legal label, e.g. 1.1.2, for cell following PREV-LABEL's cell.
With optional CHILD-P, return label for first child cell of PREV-LABEL cell.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/klabel.el
(defun klabel-type:legal-label (prev-label &optional child-p)
"Return full legal label, e.g. 1.1.2, for cell following PREV-LABEL's cell.
With optional CHILD-P, return label for first child cell of PREV-LABEL cell."
(if child-p
(if (string-equal prev-label "0")
"1"
(concat prev-label ".1"))
(let* ((last-part-index (string-match "[0-9]+$" prev-label))
(last-part (substring prev-label last-part-index))
(next-last-part (kotl-label:create (1+ (string-to-number last-part)))))
(if (equal last-part prev-label)
next-last-part
(concat (substring prev-label 0 last-part-index) next-last-part)))))