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
       ((eq spec 'all)
        (let ((result))
	  (dolist (spec (org-fold-core-folding-spec-list))
	    (let ((val (get-char-property (point) (org-fold-core--property-symbol-get-create spec nil t))))
	      (when val (push val result))))
          (reverse result)))
       ((null spec)
        (let ((result (get-char-property (point) 'invisible)))
          (when (org-fold-core-folding-spec-p result) result)))
       (t (get-char-property (point) (org-fold-core--property-symbol-get-create spec nil t)))))))