Function: org-element-cache-store-key

org-element-cache-store-key is an autoloaded and byte-compiled function defined in org-element.el.gz.

Signature

(org-element-cache-store-key EPOM KEY VALUE &optional ROBUST)

Documentation

Store KEY with VALUE associated with EPOM - point, marker, or element.

The key can be retrieved as long as the element (provided or at point) contents is not modified. If optional argument ROBUST is non-nil, the key will be retained even when the contents (children) of current element are modified. Only non-robust element modifications (affecting the element properties other then begin/end boundaries) will invalidate the key then.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;;;###autoload
(defun org-element-cache-store-key (epom key value &optional robust)
  "Store KEY with VALUE associated with EPOM - point, marker, or element.
The key can be retrieved as long as the element (provided or at point)
contents is not modified.
If optional argument ROBUST is non-nil, the key will be retained even
when the contents (children) of current element are modified.  Only
non-robust element modifications (affecting the element properties
other then begin/end boundaries) will invalidate the key then."
  (let ((element (org-element-at-point epom))
        (property (if robust :robust-cache :fragile-cache)))
    (let ((key-store (org-element-property property element)))
      (unless (hash-table-p key-store)
        (setq key-store (make-hash-table :test #'equal))
        (org-element-put-property element property key-store))
      (puthash key value key-store))))