Check to see if a contact is being stored
Before storing a link to a contact, actually check that the element at point is a contact. This calls the same matcher that is used by ‘org-contacts-db’ to see if the current element is indeed a contact.
This commit is contained in:
parent
7f03eafaad
commit
8632b1f94c
1 changed files with 6 additions and 1 deletions
|
@ -1274,7 +1274,12 @@ are effectively trimmed). If nil, all zero-length substrings are retained."
|
||||||
(when (and (eq major-mode 'org-mode)
|
(when (and (eq major-mode 'org-mode)
|
||||||
(member (buffer-file-name)
|
(member (buffer-file-name)
|
||||||
(mapcar #'expand-file-name (org-contacts-files)))
|
(mapcar #'expand-file-name (org-contacts-files)))
|
||||||
(not (org-before-first-heading-p)))
|
(not (org-before-first-heading-p))
|
||||||
|
(let ((element (org-element-at-point)))
|
||||||
|
(funcall (cdr (org-make-tags-matcher org-contacts-matcher))
|
||||||
|
(org-element-property :todo-keyword element)
|
||||||
|
(org-get-tags element)
|
||||||
|
(org-element-property :level element))))
|
||||||
(if (bound-and-true-p org-id-link-to-org-use-id)
|
(if (bound-and-true-p org-id-link-to-org-use-id)
|
||||||
(org-id-store-link)
|
(org-id-store-link)
|
||||||
(let ((headline-str (substring-no-properties (org-get-heading t t t t))))
|
(let ((headline-str (substring-no-properties (org-get-heading t t t t))))
|
||||||
|
|
Loading…
Reference in a new issue