Function: kotl-label:increment
kotl-label:increment is a byte-compiled function defined in klabel.el.
Signature
(kotl-label:increment LABEL N)
Documentation
Return LABEL incremented by N.
For example, if N were 1, 2 would become 3, z would become aa, and aa would become ab. If N were -2, 4 would become 2, etc. LABEL must be >= 1 or >= a. If LABEL is decremented below 1 or a, an error is signaled.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/klabel.el
(defun kotl-label:increment (label n)
"Return LABEL incremented by N.
For example, if N were 1, 2 would become 3, z would become aa, and aa would
become ab. If N were -2, 4 would become 2, etc.
LABEL must be >= 1 or >= a. If LABEL is decremented below 1 or a, an error
is signaled."
(if (not (kotl-label:is-p label))
(error
"(kotl-label:increment): First arg, `%s', must be a kotl-label"
label))
(let ((int-p) (val 0))
(if (or (setq int-p (kotl-label:integer-p label))
(kotl-label:alpha-p label))
;; Test if trying to decrement below 1 or a.
(if int-p
(progn (setq int-p (string-to-number label))
(if (> (setq val (+ int-p n)) 0)
(kotl-label:create val)
(error "(kotl-label:increment): Decrement of `%s' by `%d' is less than 1" label n)))
;; alpha-p
(if (<= 0 (setq val (+ n (kotl-label:alpha-to-int label))))
(kotl-label:create (kotl-label:int-to-alpha val))
(error "(kotl-label:increment): Decrement of `%s' by `%d' is illegal" label n)))
(error "(kotl-label:increment): label, `%s', must be all digits or alpha characters" label))))