Use org-store-link for adding links to other items

Daniel Borchmann 2020-09-26 18:10:34 +02:00
parent 68c6423cae
commit 4efb8cfe18
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 3 additions and 5 deletions

View File

@ -637,8 +637,7 @@ prompt for an item."
(defun db/org-add-link-to-other-item ()
"Interactively query for item and add link to it at point.
Uses `org-id-get-create' to get the ID property of the target
Use `org-store-link' to save link to `org-stored-links'."
(unless (derived-mode-p 'org-mode)
(user-error "Not in Org Mode"))
@ -648,9 +647,8 @@ headline."
(let (id item)
(org-with-point-at pom
(setq item (org-entry-get nil "ITEM")
id (org-id-get-create)))
(insert (format "[[id:%s][%s]]" id item)))))))
(org-store-link nil t))
(insert (apply #'format "[[%s][%s]]" (cl-first org-stored-links))))))))
;;; End