org-contacts.el: Add support for org-id generated link.

* contrib/lisp/org-contacts.el (org-contacts-link-store): Use org-id
store link if org-id-link-to-org-use-id is t.
This commit is contained in:
stardiviner 2020-12-17 13:51:45 +08:00
parent ca3b10d5a8
commit c8ceb5290e

View file

@ -1159,11 +1159,13 @@ are effectively trimmed). If nil, all zero-length substrings are retained."
"Store the contact in `org-contacts-files' with a link." "Store the contact in `org-contacts-files' with a link."
(when (and (eq major-mode 'org-mode) (when (and (eq major-mode 'org-mode)
(member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files))) (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files)))
(let ((headline-str (substring-no-properties (org-get-heading t t t t)))) (if org-id-link-to-org-use-id
(org-store-link-props (org-id-store-link)
:type "org-contact" (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
:link headline-str (org-store-link-props
:description headline-str)))) :type "org-contact"
:link headline-str
:description headline-str)))))
(defun org-contacts--all-contacts () (defun org-contacts--all-contacts ()
"Return an alist (name . (file . position)) of all contacts in `org-contacts-files'." "Return an alist (name . (file . position)) of all contacts in `org-contacts-files'."