* experimental: allowing 'capturing' messages, attaching them to mails
This commit is contained in:
@ -435,6 +435,20 @@ using Gnus' `message-mode'."
|
||||
;; buffer is not user-modified yet
|
||||
(set-buffer-modified-p nil)))
|
||||
|
||||
(defun mu4e-insert-captured-message ()
|
||||
"Insert the last captured message file."
|
||||
(interactive)
|
||||
(unless mu4e-captured-message
|
||||
(error "No message has been captured"))
|
||||
(let ((path (plist-get mu4e-captured-message :path)))
|
||||
(unless (file-exists-p path)
|
||||
(error "Captured message file not found"))
|
||||
(mml-attach-file
|
||||
path
|
||||
"message/rfc822"
|
||||
(or (plist-get mu4e-captured-message :subject) "No subject")
|
||||
"attachment")))
|
||||
|
||||
(defun mu4e-sent-handler (docid path)
|
||||
"Handler function, called with DOCID and PATH for the just-sent
|
||||
message."
|
||||
|
||||
@ -94,7 +94,8 @@ Function returns the CHAR typed."
|
||||
descr (substring descr 1)))
|
||||
(add-to-list 'optionkars kar)
|
||||
(concat
|
||||
"[" (propertize (make-string 1 kar) 'face 'mu4e-view-link-face) "]"
|
||||
"[" (propertize (make-string 1 kar)
|
||||
'face 'mu4e-view-link-face) "]"
|
||||
descr))) options ", "))
|
||||
(inhibit-quit nil) ;; allow C-g from read-char, not sure why this is needed
|
||||
(okchar)
|
||||
@ -107,7 +108,7 @@ Function returns the CHAR typed."
|
||||
" [" (propertize "C-g" 'face 'highlight) " to quit]")))
|
||||
(setq okchar (member response optionkars)))
|
||||
response))
|
||||
|
||||
|
||||
|
||||
(defun mu4e-get-maildirs (parentdir)
|
||||
"List the maildirs under PARENTDIR." ;; TODO: recursive?
|
||||
@ -343,9 +344,10 @@ of mu4e and emacs."
|
||||
of mu4e and emacs."
|
||||
(or mu4e-user-agent
|
||||
(format "mu4e %s; emacs %s" mu4e-mu-version emacs-version)))
|
||||
|
||||
(defun mu4e-field-at-point (field)
|
||||
"Get FIELD (a symbol, see `mu4e-header-names') for the message at
|
||||
|
||||
|
||||
(defun mu4e-message-at-point ()
|
||||
"Get the message s-expression for the message at point in either
|
||||
the headers buffer or the view buffer."
|
||||
(let ((msg
|
||||
(cond
|
||||
@ -353,7 +355,18 @@ point in eiter the headers buffer or the view buffer."
|
||||
(get-text-property (point) 'msg))
|
||||
((eq major-mode 'mu4e-view-mode)
|
||||
mu4e-current-msg))))
|
||||
(unless msg (error "No message at point"))
|
||||
(unless msg (error "No message at point"))
|
||||
msg))
|
||||
|
||||
(defun mu4e-field-at-point (field)
|
||||
"Get FIELD (a symbol, see `mu4e-header-names') for the message at
|
||||
point in eiter the headers buffer or the view buffer."
|
||||
(plist-get (mu4e-message-at-point) field))
|
||||
|
||||
(defun mu4e-capture-message ()
|
||||
"Capture the path of the message at point."
|
||||
(interactive)
|
||||
(setq mu4e-captured-message (mu4e-message-at-point))
|
||||
(message "Message has been captured"))
|
||||
|
||||
(defun mu4e-kill-buffer-and-window (buf)
|
||||
|
||||
@ -433,7 +433,7 @@ headers)."
|
||||
(:bcc . "Bcc")
|
||||
(:cc . "Cc")
|
||||
(:date . "Date")
|
||||
(:flags . "Flgs")
|
||||
(:flags . "Flags")
|
||||
(:from . "From")
|
||||
(:from-or-to . "From/To")
|
||||
(:maildir . "Maildir")
|
||||
@ -462,6 +462,9 @@ in which case it will be equal to `:to'.)")
|
||||
(defvar mu4e-current-msg nil
|
||||
"*internal* The plist describing the currently viewed message.")
|
||||
|
||||
(defvar mu4e-captured-message nil
|
||||
"*internal* the last-captured message (the s-expression).")
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; our handlers funcs
|
||||
|
||||
Reference in New Issue
Block a user