* 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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -59,6 +58,7 @@ Also see `mm/flags-to-string'.
('replied ?R)
('seen ?S)
('trashed ?T)
('attach ?a)
('encrypted ?x)
('signed ?s)
('unread ?u))))

View File

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

View File

@ -198,10 +198,16 @@ be sure it no longer matches)."
:group 'mm/faces)
(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."
: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
'((t :inherit default))
"Face for an mm header without any special flags."