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 POM CREATE PREFIX)

Documentation

Get the ID property of the entry at point-or-marker POM.

If POM is nil, refer to the entry at point. If the entry does not have an ID, the function returns nil. However, when CREATE is non-nil, create an ID if none is present already. PREFIX will be passed through to org-id-new. In any case, the ID of the entry is returned.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-id.el.gz
;;;###autoload
(defun org-id-get (&optional pom create prefix)
  "Get the ID property of the entry at point-or-marker POM.
If POM is nil, refer to the entry at point.
If the entry does not have an ID, the function returns nil.
However, when CREATE is non-nil, create an ID if none is present already.
PREFIX will be passed through to `org-id-new'.
In any case, the ID of the entry is returned."
  (org-with-point-at pom
    (let ((id (org-entry-get nil "ID")))
      (cond
       ((and id (stringp id) (string-match "\\S-" id))
	id)
       (create
	(setq id (org-id-new prefix))
	(org-entry-put pom "ID" id)
	(org-id-add-location id
			     (or org-id-overriding-file-name
				 (buffer-file-name (buffer-base-buffer))))
	id)))))