* update mm

This commit is contained in:
djcb
2011-10-24 00:20:32 +03:00
parent 92e543c803
commit 991cc06f20
3 changed files with 28 additions and 15 deletions

View File

@ -31,7 +31,6 @@
;;; converting flags->string and vice-versa ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; converting flags->string and vice-versa ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -59,6 +58,7 @@ Also see `mm/flags-to-string'.
('replied ?R) ('replied ?R)
('seen ?S) ('seen ?S)
('trashed ?T) ('trashed ?T)
('attach ?a)
('encrypted ?x) ('encrypted ?x)
('signed ?s) ('signed ?s)
('unread ?u)))) ('unread ?u))))

View File

@ -151,7 +151,8 @@ if provided, or at the end of the buffer otherwise."
((and (>= val 1000) (< val 1000000)) ((and (>= val 1000) (< val 1000000))
(format "%2.1fK" (/ val 1000.0))) (format "%2.1fK" (/ val 1000.0)))
((< val 1000) (format "%d" val)))) ((< val 1000) (format "%d" val))))
(t (error "Unsupported header field (%S)" field))))) (t
(error "Unsupported header field (%S)" field)))))
(when str (when str
(if (not width) (if (not width)
str str
@ -159,16 +160,20 @@ if provided, or at the end of the buffer otherwise."
mm/header-fields " ")) mm/header-fields " "))
(flags (plist-get msg :flags)) (flags (plist-get msg :flags))
(line (cond (line (cond
((member 'trashed flags) (propertize line 'face 'mm/trashed-face)) ((member 'draft flags)
((member 'unread flags) (propertize line 'face 'mm/unread-face)) (propertize line 'face 'mm/draft-face 'draft t))
(t (propertize line 'face 'mm/header-face))))) ((member 'trashed flags)
(propertize line 'face 'mm/trashed-face))
((member 'unread flags)
(propertize line 'face 'mm/unread-face))
(t ;; else
(propertize line 'face 'mm/header-face)))))
(mm/hdrs-add-header line (plist-get msg :docid) (mm/hdrs-add-header line (plist-get msg :docid)
(if point point (point-max))))) (if point point (point-max)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; hdrs-mode and mode-map ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; hdrs-mode and mode-map ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -291,8 +296,7 @@ on the screen, when we receive (:update ) notices from the mu
server.") server.")
(defun mm/hdrs-add-header (str docid point) (defun mm/hdrs-add-header (str docid point)
"Add header STR with DOCID to the buffer. If POINT is not "Add header STR with DOCID to the buffer at POINT."
provided, put it at the end of the buffer."
(unless docid (error "Invalid message")) (unless docid (error "Invalid message"))
(when (buffer-live-p mm/hdrs-buffer) (when (buffer-live-p mm/hdrs-buffer)
(with-current-buffer mm/hdrs-buffer (with-current-buffer mm/hdrs-buffer
@ -465,13 +469,19 @@ start editing it. COMPOSE-TYPE is either `reply', `forward' or
`edit'." `edit'."
(if (eq compose-type 'new) (if (eq compose-type 'new)
(mm/send-compose-handler 'new) (mm/send-compose-handler 'new)
(let ((docid (mm/hdrs-get-docid))) (let ((docid (mm/hdrs-get-docid))
;; note, the first two chars of the line (the mark margin) does *not*
;; have the 'draft property; thus, we check one char before the end of
;; the current line instead
(is-draft (get-text-property (- (line-end-position) 1) 'draft)))
(unless docid (unless docid
(error "No message at point.")) (error "No message at point."))
(cond (cond
((member compose-type '(reply forward)) ((member compose-type '(reply forward))
(mm/proc-compose compose-type docid)) (mm/proc-compose compose-type docid))
((eq compose-type 'edit) ((eq compose-type 'edit)
(unless is-draft
(error "Cannot edit a non-draft message"))
(mm/proc-compose 'edit docid)) (mm/proc-compose 'edit docid))
(t (error "invalid compose type %S" compose-type)))))) (t (error "invalid compose type %S" compose-type))))))
@ -635,9 +645,6 @@ folder (`mm/trash-folder')."
(mm/hdrs-compose 'edit))) (mm/hdrs-compose 'edit)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'mm-hdrs) (provide 'mm-hdrs)

View File

@ -198,10 +198,16 @@ be sure it no longer matches)."
:group 'mm/faces) :group 'mm/faces)
(defface mm/trashed-face (defface mm/trashed-face
'((t :inherit font-lock-comment-face :strike-though t)) '((t :inherit font-lock-comment-face :strike-through t))
"Face for an message header in the trash folder." "Face for an message header in the trash folder."
:group 'mm/faces) :group 'mm/faces)
(defface mm/draft-face
'((t :inherit font-lock-string-face))
"Face for a draft message header (i.e., a message with the draft
flag set)."
:group 'mm/faces)
(defface mm/header-face (defface mm/header-face
'((t :inherit default)) '((t :inherit default))
"Face for an mm header without any special flags." "Face for an mm header without any special flags."