* cleanup mu4e-user-agent a bit, add support for adding arbitrary headers

This commit is contained in:
djcb
2012-04-19 18:54:31 +03:00
parent 1e17d7890b
commit ff32d85bc0

View File

@ -519,14 +519,12 @@ buffer.
;; mu4e-compose-func and mu4e-send-func are wrappers so we can set ourselves ;; mu4e-compose-func and mu4e-send-func are wrappers so we can set ourselves
;; as default emacs mailer (define-mail-user-agent etc.) ;; as default emacs mailer (define-mail-user-agent etc.)
(defun mu4e-compose-func (&optional to subject other-headers continue (defun mu4e--compose-func (&optional to subject other-headers continue
switch-function yank-action send-actions switch-function yank-action send-actions return-action)
return-action)
"mu4e's implementation of `compose-mail'." "mu4e's implementation of `compose-mail'."
;; create a new draft message ;; create a new draft message
(mu4e-compose-handler 'new) (mu4e-compose-handler 'new)
(when to ;; reset to-address, if needed (when to ;; reset to-address, if needed
(message-goto-to) (message-goto-to)
(message-delete-line) (message-delete-line)
@ -535,18 +533,17 @@ buffer.
(message-goto-subject) (message-goto-subject)
(message-delete-line) (message-delete-line)
(insert (concat "Subject: " subject "\n"))) (insert (concat "Subject: " subject "\n")))
;; add any other headers... inspired by message-mode ;; add any other headers specified; FIXME: for some reason, these appear
;; FIXME: need to convert the headers. ;; before any other headers
;; (when other-headers (message-add-header other-headers)
;; (message-add-header other-headers)) ;; yank message
(if (bufferp yank-action) (if (bufferp yank-action)
(list 'insert-buffer yank-action) (list 'insert-buffer yank-action)
yank-action)) yank-action))
;; happily, we can reuse most things from message mode ;; happily, we can re-use most things from message mode
(define-mail-user-agent 'mu4e-user-agent (define-mail-user-agent 'mu4e-user-agent
'mu4e-compose-func 'mu4e--compose-func
'message-send-and-exit 'message-send-and-exit
'message-kill-buffer 'message-kill-buffer
'message-send-hook) 'message-send-hook)