Handle property "EMAIL" value in some cases:

- `mailto:` link
- multiple emails, multiple `mailto:` links

e.g. "[[mailto:yantar92@posteo.net]]", "[[mailto:yantar92@posteo.net][yantar92@posteo.net]]"
This commit is contained in:
stardiviner 2023-07-10 19:39:06 +08:00
parent ae45b9413e
commit 3f62975e74

View file

@ -1372,7 +1372,14 @@ Each element has the form (NAME . (FILE . POSITION))."
(with-current-buffer org-contacts-buffer (with-current-buffer org-contacts-buffer
(goto-char position) (goto-char position)
;; (symbol-name (org-property-or-variable-value 'EMAIL)) ;; (symbol-name (org-property-or-variable-value 'EMAIL))
(org-entry-get (point) "EMAIL"))))) (when-let ((pvalue (org-entry-get (point) "EMAIL")))
;; handle `mailto:' link. e.g. "[[mailto:yantar92@posteo.net]]", "[[mailto:yantar92@posteo.net][yantar92@posteo.net]]"
;; Reference the testing file `test-org-contacts.el'.
(if (string-match
"\\[\\[mailto:\\(.*\\)\\]\\(\\[.*\\]\\)\\]\\(,\\ *\\[\\[mailto:\\(.*\\)\\]\\(\\[.*\\]\\)\\]\\)"
pvalue)
(match-string 1 pvalue)
pvalue))))))
(ignore name) (ignore name)
;; (cons name email) ;; (cons name email)
email)) email))