Function: org-fold-initialize

org-fold-initialize is a byte-compiled function defined in org-fold.el.gz.

Signature

(org-fold-initialize ELLIPSIS)

Documentation

Setup folding in current Org buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-fold.el.gz
(defun org-fold-initialize (ellipsis)
  "Setup folding in current Org buffer."
  (setq-local org-fold-core-isearch-open-function #'org-fold--isearch-reveal)
  (setq-local org-fold-core-extend-changed-region-functions (list #'org-fold--extend-changed-region))
  ;; FIXME: Converting org-link + org-description to overlays when
  ;; search matches hidden "[[" part of the link, reverses priority of
  ;; link and description and hides the whole link.  Working around
  ;; this until there will be no need to convert text properties to
  ;; overlays for isearch.
  (setq-local org-fold-core--isearch-special-specs '(org-link))
  (org-fold-core-initialize
   `((,(if (eq org-fold-core-style 'text-properties) 'org-fold-outline 'outline)
      (:ellipsis . ,ellipsis)
      (:fragile . ,#'org-fold--reveal-outline-maybe)
      (:isearch-open . t)
      (:font-lock . t)
      ;; This is needed to make sure that inserting a
      ;; new planning line in folded heading is not
      ;; revealed.  Also, the below combination of :front-sticky and
      ;; :rear-sticky conforms to the overlay properties in outline.el
      ;; and the older Org versions as in `outline-flag-region'.
      (:front-sticky . t)
      (:rear-sticky . nil)
      (:alias . (headline heading outline inlinetask plain-list)))
     (,(if (eq org-fold-core-style 'text-properties) 'org-fold-block 'org-hide-block)
      (:ellipsis . ,ellipsis)
      (:fragile . ,#'org-fold--reveal-drawer-or-block-maybe)
      (:isearch-open . t)
      (:font-lock . t)
      (:front-sticky . t)
      (:alias . ( block center-block comment-block
                  dynamic-block example-block export-block
                  quote-block special-block src-block
                  verse-block)))
     (,(if (eq org-fold-core-style 'text-properties) 'org-fold-drawer 'org-hide-drawer)
      (:ellipsis . ,ellipsis)
      (:fragile . ,#'org-fold--reveal-drawer-or-block-maybe)
      (:isearch-open . t)
      (:font-lock . t)
      (:front-sticky . t)
      (:alias . (drawer property-drawer))))))