Function: org-id-store-link-maybe

org-id-store-link-maybe is an autoloaded and byte-compiled function defined in org-id.el.gz.

Signature

(org-id-store-link-maybe &optional INTERACTIVE?)

Documentation

Store a link to the current entry using its ID if enabled.

The value of org-id-link-to-org-use-id determines whether an ID link should be stored, using org-id-store-link.

Assume the function is called interactively if INTERACTIVE? is non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-id.el.gz
;;;###autoload
(defun org-id-store-link-maybe (&optional interactive?)
  "Store a link to the current entry using its ID if enabled.

The value of `org-id-link-to-org-use-id' determines whether an ID
link should be stored, using `org-id-store-link'.

Assume the function is called interactively if INTERACTIVE? is
non-nil."
  (when (and (buffer-file-name (buffer-base-buffer))
             (derived-mode-p 'org-mode)
             (or (eq org-id-link-to-org-use-id t)
                 (and interactive?
                      (or (eq org-id-link-to-org-use-id 'create-if-interactive)
                          (and (eq org-id-link-to-org-use-id
                                   'create-if-interactive-and-no-custom-id)
                               (not (org-entry-get nil "CUSTOM_ID")))))
                 ;; 'use-existing
                 (and org-id-link-to-org-use-id
                      (org-id--get-id-to-store-link))))
    (org-id-store-link)))