Function: org-link-email-description

org-link-email-description is a byte-compiled function defined in ol.el.gz.

Signature

(org-link-email-description &optional FMT)

Documentation

Return the description part of an email link.

This takes information from org-store-link-plist and formats it according to FMT (default from org-link-email-description-format).

Aliases

org-email-link-description (obsolete since 9.3)

Source Code

;; Defined in /usr/src/emacs/lisp/org/ol.el.gz
(defun org-link-email-description (&optional fmt)
  "Return the description part of an email link.
This takes information from `org-store-link-plist' and formats it
according to FMT (default from `org-link-email-description-format')."
  (setq fmt (or fmt org-link-email-description-format))
  (let* ((p org-store-link-plist)
	 (to (plist-get p :toaddress))
	 (from (plist-get p :fromaddress))
	 (table
	  (list
	   (cons "%c" (plist-get p :fromto))
	   (cons "%F" (plist-get p :from))
	   (cons "%f" (or (plist-get p :fromname) (plist-get p :fromaddress) "?"))
	   (cons "%T" (plist-get p :to))
	   (cons "%t" (or (plist-get p :toname) (plist-get p :toaddress) "?"))
	   (cons "%s" (plist-get p :subject))
	   (cons "%d" (plist-get p :date))
	   (cons "%m" (plist-get p :message-id)))))
    (when (string-match "%c" fmt)
      ;; Check if the user wrote this message
      (if (and org-link-from-user-regexp from to
	       (save-match-data (string-match org-link-from-user-regexp from)))
	  (setq fmt (replace-match "to %t" t t fmt))
	(setq fmt (replace-match "from %f" t t fmt))))
    (org-replace-escapes fmt table)))