Function: hyrolo-name-and-email
hyrolo-name-and-email is a byte-compiled function defined in
hyrolo.el.
Signature
(hyrolo-name-and-email)
Documentation
If point is in a mail message, return list of (name email-addr) of sender.
Name is returned as last, first-and-middle.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hyrolo.el
(defun hyrolo-name-and-email ()
"If point is in a mail message, return list of (name email-addr) of sender.
Name is returned as `last, first-and-middle'."
(let ((email) (name) (from))
(save-window-excursion
(if (or (hmail:lister-p) (hnews:lister-p))
(other-window 1))
(save-excursion
(save-restriction
(goto-char (point-min))
(if (search-forward "\n\n" nil t)
(narrow-to-region (point-min) (point)))
(setq email (mail-fetch-field "reply-to")
from (mail-fetch-field "from")))))
(if from
(cond
;; Match: email, email (name), email "name"
((string-match
(concat "^\\([^\"<>() \t\n\r\f]+\\)"
"\\([ \t]*[(\"][ \t]*\\([^\"()]+\\)[ \t]+"
"\\([^\" \t()]+\\)[ \t]*[)\"]\\)?[ \t]*$")
from)
(setq name (hyrolo-format-name from 3 4))
(or email (setq email (match-string 1 from))))
;; Match: <email>, name <email>, "name" <email>
((string-match
(concat "^\\(\"?\\([^\"<>()\n]+\\)[ \t]+"
"\\([^\" \t()<>]+\\)\"?[ \t]+\\)?"
"<\\([^\"<>() \t\n\r\f]+\\)>[ \t]*$")
from)
(setq name (hyrolo-format-name from 2 3))
(or email (setq email (match-string 4 from))))))
(if (or name email)
(list name email))))