Function: org-get-valid-level
org-get-valid-level is a byte-compiled function defined in org.el.gz.
Signature
(org-get-valid-level LEVEL &optional CHANGE)
Documentation
Rectify a level change under the influence of org-odd-levels-only.
LEVEL is a current level, CHANGE is by how much the level should be modified. Even if CHANGE is nil, LEVEL may be returned modified because even level numbers will become the next higher odd number. Returns values greater than 0.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-get-valid-level (level &optional change)
"Rectify a level change under the influence of `org-odd-levels-only'.
LEVEL is a current level, CHANGE is by how much the level should
be modified. Even if CHANGE is nil, LEVEL may be returned
modified because even level numbers will become the next higher
odd number. Returns values greater than 0."
(if org-odd-levels-only
(cond ((or (not change) (= 0 change)) (1+ (* 2 (/ level 2))))
((> change 0) (1+ (* 2 (/ (+ (1- level) (* 2 change)) 2))))
((< change 0) (max 1 (1+ (* 2 (/ (+ level (* 2 change)) 2))))))
(max 1 (+ level (or change 0)))))