* mm updates

This commit is contained in:
djcb
2011-11-09 08:55:39 +02:00
parent bebcf53d3b
commit 7a4ad0bc0b
2 changed files with 19 additions and 18 deletions

View File

@ -103,12 +103,13 @@ or if not available, :body-html converted to text)."
. \"a@example.com\") (\"B\" . \"B@example.com\") (nil . \"a@example.com\") (\"B\" . \"B@example.com\") (nil
. \"c@example.com\")) into a string of form \"A <@aexample.com>, B . \"c@example.com\")) into a string of form \"A <@aexample.com>, B
<b@example.com>, c@example.com\." <b@example.com>, c@example.com\."
(mapconcat (when lst
(lambda (recip) (mapconcat
(let ((name (car recip)) (email (cdr recip))) (lambda (recip)
(if name (let ((name (car recip)) (email (cdr recip)))
(format "%s <%s>" name email) (if name
(format "%s" email)))) lst ", ")) (format "%s <%s>" name email)
(format "%s" email)))) lst ", ")))
(defun mm/msg-header (hdr val) (defun mm/msg-header (hdr val)
@ -132,14 +133,14 @@ return nil."
(defun mm/msg-to-create (msg) (defun mm/msg-to-create (msg)
"Construct the To: header for a reply-message based on some "Construct the To: header for a reply-message based on some
message MSG. This the the Reply-To address of MSG if it exist, or message MSG. This takes the Reply-To address of MSG if it exist, or
the From:-address otherwise. The result is either nil or a string the From:-address otherwise. The result is either nil or a string
which can be used for the To:-field." which can be used for the To:-field. Note, when it's present,
(let ((to-lst (plist-get msg :to)) Reply-To contains a string of one or more addresses,
(reply-to (plist-get msg :reply-to)) comma-separated."
(from (plist-get msg :from))) (or
(setq to-lst (or reply-to from)) (plist-get msg :reply-to)
(mm/msg-recipients-to-string to-lst))) (mm/msg-recipients-to-string (plist-get msg :from))))
(defun mm/msg-cc-create (msg reply-all) (defun mm/msg-cc-create (msg reply-all)
@ -275,7 +276,7 @@ the new message to the database. When the draft message is added to
the database, `mm/path-docid-map' will be updated, so that we can the database, `mm/path-docid-map' will be updated, so that we can
use the new docid. Returns the full path to the new message." use the new docid. Returns the full path to the new message."
(let* ((hostname (let* ((hostname
(downcase (downcase
(save-match-data (save-match-data
(substring system-name (substring system-name
(string-match "^[^.]+" system-name) (match-end 0))))) (string-match "^[^.]+" system-name) (match-end 0)))))
@ -331,7 +332,7 @@ using Gnus' `message-mode'."
(unless (file-readable-p draft) (unless (file-readable-p draft)
(error "Cannot read %s" path)) (error "Cannot read %s" path))
(find-file draft) (find-file draft)
(message-mode) (message-mode)

View File

@ -472,9 +472,9 @@ maildirs under `mm/maildir."
(kar (read-char (concat prompt fnames)))) (kar (read-char (concat prompt fnames))))
(if (= kar ?o) ;; user chose 'other'? (if (= kar ?o) ;; user chose 'other'?
(ido-completing-read prompt (mm/get-sub-maildirs mm/maildir)) (ido-completing-read prompt (mm/get-sub-maildirs mm/maildir))
(unless (car-safe (or
(find-if (lambda (item) (= kar (cdr item))) mm/maildir-shortcuts)) (car-safe (find-if (lambda (item) (= kar (cdr item))) mm/maildir-shortcuts))
(error "Invalid shortcut")))))) (error "Invalid shortcut '%c'" kar))))))
(defun mm/new-buffer (bufname) (defun mm/new-buffer (bufname)