Function: rmail-summary-name-or-address

rmail-summary-name-or-address is a byte-compiled function defined in rmailsum.el.gz.

Signature

(rmail-summary-name-or-address ADDRESS)

Documentation

Return the first parsed address in ADDRESS as a display string.

Return the first address's real name when it is non-empty; otherwise return its email address when that is non-empty. If no address yields either, return unfolded ADDRESS trimmed of surrounding whitespace.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmailsum.el.gz
(defun rmail-summary-name-or-address (address)
  "Return the first parsed address in ADDRESS as a display string.
Return the first address's real name when it is non-empty; otherwise
return its email address when that is non-empty.  If no address yields
either, return unfolded ADDRESS trimmed of surrounding whitespace."
  (require 'mail-parse)
  (let* ((unfolded (replace-regexp-in-string "[\r\n]+[ \t]*" " " address))
         (first (car (mail-header-parse-addresses unfolded))))
    (or (rmail-summary--address-display first)
        (string-trim unfolded))))