Function: org-element--cache-active-p

org-element--cache-active-p is a byte-compiled function defined in org-element.el.gz.

Signature

(org-element--cache-active-p &optional CALLED-FROM-CACHE-CHANGE-FUNC-P)

Documentation

Non-nil when cache is active in current buffer.

When CALLED-FROM-CACHE-CHANGE-FUNC-P is non-nil, do not assert cache consistency with buffer modifications.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;;;; Tools

;; FIXME: `org-fold-core-cycle-over-indirect-buffers' should better be
;; taken out of org-fold-core to track indirect buffers in general.
(defun org-element--cache-active-p (&optional called-from-cache-change-func-p)
  "Non-nil when cache is active in current buffer.
When CALLED-FROM-CACHE-CHANGE-FUNC-P is non-nil, do not assert cache
consistency with buffer modifications."
  (org-with-base-buffer nil
    (and org-element-use-cache
         (or org-element--cache
             (when (derived-mode-p 'org-mode)
               (org-element-cache-reset)
               t))
         (or called-from-cache-change-func-p
             (eq org-element--cache-change-tic (buffer-chars-modified-tick))
             (and
              ;; org-num-mode calls some Org structure analysis functions
              ;; that can trigger cache update in the middle of changes.  See
              ;; `org-num--verify' calling `org-num--skip-value' calling
              ;; `org-entry-get' that uses cache.
              ;; Forcefully disable cache when called from inside a
              ;; modification hook, where `inhibit-modification-hooks' is set
              ;; to t.
              (not inhibit-modification-hooks)
              ;; `combine-change-calls' sets `after-change-functions' to
              ;; nil.  We need not to use cache inside
              ;; `combine-change-calls' because the buffer is potentially
              ;; changed without notice (the change will be registered
              ;; after exiting the `combine-change-calls' body though).
              (catch :inhibited
                (org-fold-core-cycle-over-indirect-buffers
                  (unless (memq #'org-element--cache-after-change after-change-functions)
                    (throw :inhibited nil)))
                t))))))