From 3f62975e742154f261c6465be74b27be1f3df72e Mon Sep 17 00:00:00 2001 From: stardiviner Date: Mon, 10 Jul 2023 19:39:06 +0800 Subject: [PATCH] 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]]" --- org-contacts.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/org-contacts.el b/org-contacts.el index ca40b84..d6bccbe 100644 --- a/org-contacts.el +++ b/org-contacts.el @@ -1372,7 +1372,14 @@ Each element has the form (NAME . (FILE . POSITION))." (with-current-buffer org-contacts-buffer (goto-char position) ;; (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) ;; (cons name email) email))