Function: org-element-cache-get-key

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

Signature

(org-element-cache-get-key EPOM KEY &optional DEFAULT)

Documentation

Get KEY associated with EPOM - point, marker, or element.

Return DEFAULT when KEY is not associated with EPOM. The key can be retrieved as long as the element (provided or at point) contents is not modified.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;;;###autoload
(defun org-element-cache-get-key (epom key &optional default)
  "Get KEY associated with EPOM - point, marker, or element.
Return DEFAULT when KEY is not associated with EPOM.
The key can be retrieved as long as the element (provided or at point)
contents is not modified."
  (let ((element (org-element-at-point epom)))
    (let ((key-store1 (org-element-property :fragile-cache element))
          (key-store2 (org-element-property :robust-cache element)))
      (let ((val1 (if (hash-table-p key-store1)
                      (gethash key key-store1 'not-found)
                    'not-found))
            (val2 (if (hash-table-p key-store2)
                      (gethash key key-store2 'not-found)
                    'not-found)))
        (cond
         ((and (eq 'not-found val1)
               (eq 'not-found val2))
          default)
         ((eq 'not-found val1) val2)
         ((eq 'not-found val2) val1))))))