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

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

Signature

(org-fold-core-add-folding-spec SPEC &optional PROPERTIES BUFFER APPEND)

Documentation

Add a new folding SPEC with PROPERTIES in BUFFER.

SPEC must be a symbol. BUFFER can be a buffer to set SPEC in or nil to set SPEC in current buffer.

By default, the added SPEC will have highest priority among the previously defined specs. When optional APPEND argument is non-nil, SPEC will have the lowest priority instead. If SPEC was already defined earlier, it will be redefined according to provided optional arguments.
`
The folding spec properties will be set to PROPERTIES (see org-fold-core--specs for details).

Aliases

org-fold-add-folding-spec

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-fold-core.el.gz
(defun org-fold-core-add-folding-spec (spec &optional properties buffer append)
  "Add a new folding SPEC with PROPERTIES in BUFFER.

SPEC must be a symbol.  BUFFER can be a buffer to set SPEC in or nil to
set SPEC in current buffer.

By default, the added SPEC will have highest priority among the
previously defined specs.  When optional APPEND argument is non-nil,
SPEC will have the lowest priority instead.  If SPEC was already
defined earlier, it will be redefined according to provided optional
arguments.
`
The folding spec properties will be set to PROPERTIES (see
`org-fold-core--specs' for details)."
  (when (eq spec 'all) (error "Cannot use reserved folding spec symbol 'all"))
  (with-current-buffer (or buffer (current-buffer))
    ;; Clear the cache.
    (setq org-fold-core--spec-list nil
          org-fold-core--spec-symbols nil)
    (let* ((full-properties (mapcar (lambda (prop) (cons prop (cdr (assq prop properties))))
                                    '( :visible :ellipsis :isearch-ignore
                                       :global :isearch-open :front-sticky
                                       :rear-sticky :fragile :alias)))
           (full-spec (cons spec full-properties)))
      (add-to-list 'org-fold-core--specs full-spec append)
      (mapc (lambda (prop-cons) (org-fold-core-set-folding-spec-property spec (car prop-cons) (cdr prop-cons) 'force)) full-properties)
      ;; Update buffer inivisibility specs.
      (org-fold-core--property-symbol-get-create spec))))