Function: org-fold-core-get-folding-spec

org-fold-core-get-folding-spec is a byte-compiled function defined in org-fold-core.el.gz.

Signature

(org-fold-core-get-folding-spec &optional SPEC-OR-ALIAS POM)

Documentation

Get folding state at point or POM.

Return nil if there is no folding at point or POM. If SPEC-OR-ALIAS is nil, return a folding spec with highest priority among present at point or POM. If SPEC-OR-ALIAS is all, return the list of all present folding specs. If SPEC-OR-ALIAS is a valid folding spec or a spec alias, return the corresponding folding spec (if the text is folded using that spec).

Aliases

org-fold-get-folding-spec

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-fold-core.el.gz
(defun org-fold-core-get-folding-spec (&optional spec-or-alias pom)
  "Get folding state at `point' or POM.
Return nil if there is no folding at point or POM.
If SPEC-OR-ALIAS is nil, return a folding spec with highest priority
among present at `point' or POM.
If SPEC-OR-ALIAS is `all', return the list of all present folding
specs.
If SPEC-OR-ALIAS is a valid folding spec or a spec alias, return the
corresponding folding spec (if the text is folded using that spec)."
  (let ((spec (if (eq spec-or-alias 'all)
                  'all
                (org-fold-core-get-folding-spec-from-alias spec-or-alias))))
    (when (and spec (not (eq spec 'all))) (org-fold-core--check-spec spec))
    (org-with-point-at pom
      (cond
       ((or (null spec) (eq spec 'all))
        (catch :single-spec
          (let ((result))
	    (dolist (lspec (org-fold-core-folding-spec-list))
	      (let ((val (if (eq org-fold-core-style 'text-properties)
                             (get-text-property (point) (org-fold-core--property-symbol-get-create lspec nil t))
                           (get-char-property (point) (org-fold-core--property-symbol-get-create lspec nil t)))))
                (when (and val (null spec)) (throw :single-spec val))
                (when val (push val result))))
            (reverse result))))
       (t (if (eq org-fold-core-style 'text-properties)
              (get-text-property (point) (org-fold-core--property-symbol-get-create spec nil t))
            (get-char-property (point) (org-fold-core--property-symbol-get-create spec nil t))))))))