Function: org-fold-core-next-folding-state-change

org-fold-core-next-folding-state-change is a byte-compiled function defined in org-fold-core.el.gz.

Signature

(org-fold-core-next-folding-state-change &optional SPEC-OR-ALIAS POS LIMIT PREVIOUS-P)

Documentation

Return point after POS where folding state changes up to LIMIT.

If SPEC-OR-ALIAS is nil, return next point where _any_ single folding spec changes. For example, (org-fold-core-next-folding-state-change nil) with point somewhere in the below structure will return the nearest <...> point.

* Headline <begin outline fold>
:PROPERTIES:<begin drawer fold>
:ID: test
:END:<end drawer fold>

Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo, quis tempor ligula erat quis odio.

** Another headline
:DRAWER:<begin drawer fold>
:END:<end drawer fold>
** Yet another headline
<end of outline fold>

If SPEC-OR-ALIAS is a folding spec symbol, only consider that folding spec.

If SPEC-OR-ALIAS is a list, only consider changes of folding specs from the list.

Search backwards when PREVIOUS-P is non-nil.

Aliases

org-fold-next-folding-state-change

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-fold-core.el.gz
(defun org-fold-core-next-folding-state-change (&optional spec-or-alias pos limit previous-p)
  "Return point after POS where folding state changes up to LIMIT.
If SPEC-OR-ALIAS is nil, return next point where _any_ single folding
spec changes.
For example, (org-fold-core-next-folding-state-change nil) with point
somewhere in the below structure will return the nearest <...> point.

* Headline <begin outline fold>
:PROPERTIES:<begin drawer fold>
:ID: test
:END:<end drawer fold>

Fusce suscipit, wisi nec facilisis facilisis, est dui fermentum leo,
quis tempor ligula erat quis odio.

** Another headline
:DRAWER:<begin drawer fold>
:END:<end drawer fold>
** Yet another headline
<end of outline fold>

If SPEC-OR-ALIAS is a folding spec symbol, only consider that folding
spec.

If SPEC-OR-ALIAS is a list, only consider changes of folding specs
from the list.

Search backwards when PREVIOUS-P is non-nil."
  (when (and spec-or-alias (symbolp spec-or-alias))
    (setq spec-or-alias (list spec-or-alias)))
  (when spec-or-alias
    (setq spec-or-alias
	  (mapcar (lambda (spec-or-alias)
		    (or (org-fold-core-get-folding-spec-from-alias spec-or-alias)
			spec-or-alias))
                  spec-or-alias))
    (mapc #'org-fold-core--check-spec spec-or-alias))
  (unless spec-or-alias
    (setq spec-or-alias (org-fold-core-folding-spec-list)))
  (setq pos (or pos (point)))
  (apply (if previous-p
	     #'max
	   #'min)
         (mapcar (if previous-p
		     (lambda (prop) (max (or limit (point-min)) (previous-single-char-property-change pos prop nil (or limit (point-min)))))
		   (lambda (prop) (next-single-char-property-change pos prop nil (or limit (point-max)))))
                 (mapcar (lambda (el) (org-fold-core--property-symbol-get-create el nil t))
                         spec-or-alias))))