* mm updates

This commit is contained in:
djcb
2011-11-09 08:35:24 +02:00
parent b684dbc06c
commit bebcf53d3b
4 changed files with 94 additions and 82 deletions

View File

@ -33,10 +33,8 @@
(require 'mm-send)
(require 'mm-proc)
;; TODO: get this version through to Makefile magic
(defconst mm/version "0.9.8pre"
"*internal* my version")
;; mm-version.el is autogenerated, and defines mm/mu-version
(require 'mm-version)
;; Customization
@ -63,7 +61,6 @@ PATH, you can specifiy the full path."
:safe 'stringp
:group 'mm)
(defcustom mm/get-mail-command nil
"Shell command to run to retrieve new mail; e.g. 'offlineimap' or
'fetchmail'."
@ -77,6 +74,15 @@ PATH, you can specifiy the full path."
:group 'mm
:safe 'stringp)
(defvar mm/user-mail-address-regexp "$^"
"Regular expression matching the user's mail address(es). This is
used to distinguish ourselves from others, e.g. when replying and
in :from-or-to headers. By default, match nothing.")
(defvar mm/date-format-long "%c"
"Date format to use in the message view, in the format of
`format-time-string'.")
(defvar mm/debug nil
"When set to non-nil, log debug information to the *mm-log* buffer.")
@ -133,7 +139,7 @@ designated shortcut character for the maildir.")
:group 'mm)
(defcustom mm/header-fields
(defcustom mm/headers-fields
'( (:date . 25)
(:flags . 6)
(:from . 22)
@ -141,7 +147,16 @@ designated shortcut character for the maildir.")
"A list of header fields to show in the headers buffer, and their
respective widths in characters. A width of `nil' means
'unrestricted', and this is best reserved fo the rightmost (last)
field. For the complete list of available headers, see `mm/header-names'")
field. For the complete list of available headers, see `mm/header-names'"
:type (list 'symbol)
:group 'mm/headers)
(defcustom mm/headers-date-format "%x %X"
"Date format to use in the headers view, in the format of
`format-time-string'."
:type 'string
:group 'mm/headers)
;; the message view
(defgroup mm/view nil
@ -151,10 +166,15 @@ designated shortcut character for the maildir.")
(defcustom mm/view-fields
'(:from :to :cc :subject :flags :date :maildir :path :attachments)
"Header fields to display in the message view buffer. For the
complete list of available headers, see `mm/header-names'"
complete list of available headers, see `mm/header-names'."
:type (list 'symbol)
:group 'mm/view)
(defcustom mm/view-date-format "%c"
"Date format to use in the message view, in the format of
`format-time-string'."
:type 'string
:group 'mm/headers)
;; Composing / Sending messages
(defgroup mm/compose nil
@ -264,16 +284,11 @@ flag set)."
headers)."
:group 'mm/faces)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; internal variables / constants
(defconst mm/mm-buffer-name "*mm*"
"*internal* Name of the mm main buffer.")
(defvar mm/mu-version nil
"*interal* version of the mu binary")
(defconst mm/header-names
'( (:attachments . "Attach")
(:bcc . "Bcc")
@ -341,24 +356,16 @@ in which case it will be equal to `:to'.)")
(insert
"* "
(propertize "mm - mail for emacs version " 'face 'mm/title-face)
(propertize mm/version 'face 'mm/view-header-value-face)
(propertize mm/mu-version 'face 'mm/view-header-value-face)
" (send: "
(propertize (if smtpmail-queue-mail "queued" "direct")
'face 'mm/view-header-key-face)
")"
"\n\n"
" Watcha wanna do?\n\n"
" * Show me some messages:\n"
" - In your " (propertize "I" 'face 'highlight) "nbox\n"
" - " (propertize "U" 'face 'highlight) "nread messages\n"
" - " (propertize "D" 'face 'highlight) "raft messages\n"
" - Received " (propertize "T" 'face 'highlight) "oday\n"
" - Received this " (propertize "W" 'face 'highlight) "eek\n"
"\n"
" * " (propertize "j" 'face 'highlight) "ump to a folder\n"
" * " (propertize "s" 'face 'highlight) "earch for a specific message\n"
"\n"
" * " (propertize "c" 'face 'highlight) "ompose a new message\n"
" - " (propertize "j" 'face 'highlight) "ump to some maildir\n"
" - " (propertize "s" 'face 'highlight) "earch for a specific message\n"
" - " (propertize "c" 'face 'highlight) "ompose a new message\n"
"\n"
"\n"
@ -456,7 +463,6 @@ maildirs under `mm/maildir."
(fnames
(mapconcat
(lambda (item)
(message "%S" item)
(concat
"["
(propertize (make-string 1 (cdr item)) 'face 'mm/view-link-face)
@ -464,11 +470,12 @@ maildirs under `mm/maildir."
(car item)))
mlist ", "))
(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))
(car-safe
(find-if (lambda (item) (= kar (cdr item))) mm/maildir-shortcuts))))))
(unless (car-safe
(find-if (lambda (item) (= kar (cdr item))) mm/maildir-shortcuts))
(error "Invalid shortcut"))))))
(defun mm/new-buffer (bufname)
"Return a new buffer BUFNAME; if such already exists, kill the