Function: org-id-store-link

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

Signature

(org-id-store-link)

Documentation

Store a link to the current entry, using its ID.

If before first heading store first title-keyword as description or filename if no title.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-id.el.gz
;; id link type

;; Calling the following function is hard-coded into `org-store-link',
;; so we do have to add it to `org-store-link-functions'.

;;;###autoload
(defun org-id-store-link ()
  "Store a link to the current entry, using its ID.

If before first heading store first title-keyword as description
or filename if no title."
  (interactive)
  (when (and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 'org-mode))
    (let* ((link (concat "id:" (org-id-get-create)))
	   (case-fold-search nil)
	   (desc (save-excursion
		   (org-back-to-heading-or-point-min t)
                   (cond ((org-before-first-heading-p)
                          (let ((keywords (org-collect-keywords '("TITLE"))))
                            (if keywords
                                (cadr (assoc "TITLE" keywords))
                              (file-name-nondirectory
			       (buffer-file-name (buffer-base-buffer))))))
                         ((looking-at org-complex-heading-regexp)
			  (if (match-end 4)
			      (match-string 4)
			    (match-string 0)))
                         (t link)))))
      (org-link-store-props :link link :description desc :type "id")
      link)))