Function: org-fold-core-regions

org-fold-core-regions is a macro defined in org-fold-core.el.gz.

Signature

(org-fold-core-regions REGIONS &key OVERRIDE CLEAN-MARKERS RELATIVE)

Documentation

Fold every region in REGIONS list in current buffer.

Each region in the list is a list (BEG END SPEC-OR-ALIAS) describing region and folding spec to be applied.

When optional argument OVERRIDE is non-nil, clear folding state in the buffer first.

When optional argument CLEAN-MARKERS is non-nil, clear markers used to mark region boundaries in REGIONS.

When optional argument RELATIVE is non-nil, it must be a buffer position. REGION boundaries are then treated as relative distances from that position.

Aliases

org-fold-regions

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-fold-core.el.gz
(cl-defmacro org-fold-core-regions (regions &key override clean-markers relative)
  "Fold every region in REGIONS list in current buffer.

Each region in the list is a list (BEG END SPEC-OR-ALIAS) describing
region and folding spec to be applied.

When optional argument OVERRIDE is non-nil, clear folding state in the
buffer first.

When optional argument CLEAN-MARKERS is non-nil, clear markers used to
mark region boundaries in REGIONS.

When optional argument RELATIVE is non-nil, it must be a buffer
position.  REGION boundaries are then treated as relative distances
from that position."
  `(org-with-wide-buffer
    (when ,override (org-fold-core-region (point-min) (point-max) nil))
    (pcase-dolist (`(,beg ,end ,spec) (delq nil ,regions))
      (let ((rel ,relative))
        (if rel
            (org-fold-core-region (+ rel beg) (+ rel end) t spec)
          (org-fold-core-region beg end t spec)))
      (when ,clean-markers
        (when (markerp beg) (set-marker beg nil))
        (when (markerp end) (set-marker end nil))))))