Function: org-id-get

org-id-get is an autoloaded and byte-compiled function defined in org-id.el.gz.

Signature

(org-id-get &optional EPOM CREATE PREFIX INHERIT)

Documentation

Get the ID of the entry at EPOM.

EPOM is an element, marker, or buffer position. If EPOM is nil, refer to the entry at point.

If INHERIT is non-nil, ID properties inherited from parent entries are considered. Otherwise, only ID properties on the entry itself are considered.

When CREATE is nil, return the ID of the entry if found, otherwise nil. When CREATE is non-nil, create an ID if none has been found, and return the new ID. PREFIX will be passed through to org-id-new.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-id.el.gz
;;;###autoload
(defun org-id-get (&optional epom create prefix inherit)
  "Get the ID of the entry at EPOM.

EPOM is an element, marker, or buffer position.  If EPOM is nil,
refer to the entry at point.

If INHERIT is non-nil, ID properties inherited from parent
entries are considered.  Otherwise, only ID properties on the
entry itself are considered.

When CREATE is nil, return the ID of the entry if found,
otherwise nil.  When CREATE is non-nil, create an ID if none has
been found, and return the new ID.  PREFIX will be passed through
to `org-id-new'."
  (let ((id (org-entry-get epom "ID" (and inherit t))))
    (cond
     ((and id (stringp id) (string-match "\\S-" id))
      id)
     (create
      (setq id (org-id-new prefix))
      (org-entry-put epom "ID" id)
      (org-with-point-at epom
        (org-id-add-location id
			     (or org-id-overriding-file-name
                                 (buffer-file-name (buffer-base-buffer)))))
      id))))