Open molok opened 10 months ago
example of such function
(defun org-msg-tag-addressee()
"Completes an email address in the current buffer with an org-mode mailto link"
(interactive)
(let* ((addressees
(append
(mail-extract-address-components (org-msg-message-fetch-field "to") t)
(mail-extract-address-components (org-msg-message-fetch-field "cc") t)))
(mail-addresses (mapcar (lambda(e)
(if (car e)
(format "%s <%s>" (car e) (cadr e))
(format "<%s>" (cadr e)))) addressees))
(end (point))
(start (save-excursion
(skip-chars-backward "^@")
(point)))
(prefix (buffer-substring start end))
(completion (completing-read "Complete email for: "
mail-addresses
(lambda (c)
(string-match-p (regexp-quote prefix)
(downcase c)))
t)))
(if (not (string-equal prefix completion))
(progn
(delete-region (- start 1) end)
(insert
(if (string-match "\\(.*\\) <\\(.*\\)>" completion)
(let ((name (match-string 1 completion))
(email (match-string 2 completion)))
(format "[[mailto:%s][@%s]]" email name))
(if (string-match "<\\(.*\\)>" completion)
(let ((email (match-string 1 completion)))
(format "[[mailto:%s][@%s]]" email (car (split-string email "@")))))))))))
@molok Please review the pull request implementing this feature.
In my work environment (Outlook based) I often see people tagging each other using
@Name
, which in Outlook actually generates a mailto link. I think it might be appropriate to have this kind of feature in org-msg.