* 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
|
;; buffer is not user-modified yet
|
||||||
(set-buffer-modified-p nil)))
|
(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)
|
(defun mu4e-sent-handler (docid path)
|
||||||
"Handler function, called with DOCID and PATH for the just-sent
|
"Handler function, called with DOCID and PATH for the just-sent
|
||||||
message."
|
message."
|
||||||
|
|||||||
@ -94,7 +94,8 @@ Function returns the CHAR typed."
|
|||||||
descr (substring descr 1)))
|
descr (substring descr 1)))
|
||||||
(add-to-list 'optionkars kar)
|
(add-to-list 'optionkars kar)
|
||||||
(concat
|
(concat
|
||||||
"[" (propertize (make-string 1 kar) 'face 'mu4e-view-link-face) "]"
|
"[" (propertize (make-string 1 kar)
|
||||||
|
'face 'mu4e-view-link-face) "]"
|
||||||
descr))) options ", "))
|
descr))) options ", "))
|
||||||
(inhibit-quit nil) ;; allow C-g from read-char, not sure why this is needed
|
(inhibit-quit nil) ;; allow C-g from read-char, not sure why this is needed
|
||||||
(okchar)
|
(okchar)
|
||||||
@ -107,7 +108,7 @@ Function returns the CHAR typed."
|
|||||||
" [" (propertize "C-g" 'face 'highlight) " to quit]")))
|
" [" (propertize "C-g" 'face 'highlight) " to quit]")))
|
||||||
(setq okchar (member response optionkars)))
|
(setq okchar (member response optionkars)))
|
||||||
response))
|
response))
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e-get-maildirs (parentdir)
|
(defun mu4e-get-maildirs (parentdir)
|
||||||
"List the maildirs under PARENTDIR." ;; TODO: recursive?
|
"List the maildirs under PARENTDIR." ;; TODO: recursive?
|
||||||
@ -343,9 +344,10 @@ of mu4e and emacs."
|
|||||||
of mu4e and emacs."
|
of mu4e and emacs."
|
||||||
(or mu4e-user-agent
|
(or mu4e-user-agent
|
||||||
(format "mu4e %s; emacs %s" mu4e-mu-version emacs-version)))
|
(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."
|
the headers buffer or the view buffer."
|
||||||
(let ((msg
|
(let ((msg
|
||||||
(cond
|
(cond
|
||||||
@ -353,7 +355,18 @@ point in eiter the headers buffer or the view buffer."
|
|||||||
(get-text-property (point) 'msg))
|
(get-text-property (point) 'msg))
|
||||||
((eq major-mode 'mu4e-view-mode)
|
((eq major-mode 'mu4e-view-mode)
|
||||||
mu4e-current-msg))))
|
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"))
|
(message "Message has been captured"))
|
||||||
|
|
||||||
(defun mu4e-kill-buffer-and-window (buf)
|
(defun mu4e-kill-buffer-and-window (buf)
|
||||||
|
|||||||
@ -433,7 +433,7 @@ headers)."
|
|||||||
(:bcc . "Bcc")
|
(:bcc . "Bcc")
|
||||||
(:cc . "Cc")
|
(:cc . "Cc")
|
||||||
(:date . "Date")
|
(:date . "Date")
|
||||||
(:flags . "Flgs")
|
(:flags . "Flags")
|
||||||
(:from . "From")
|
(:from . "From")
|
||||||
(:from-or-to . "From/To")
|
(:from-or-to . "From/To")
|
||||||
(:maildir . "Maildir")
|
(:maildir . "Maildir")
|
||||||
@ -462,6 +462,9 @@ in which case it will be equal to `:to'.)")
|
|||||||
(defvar mu4e-current-msg nil
|
(defvar mu4e-current-msg nil
|
||||||
"*internal* The plist describing the currently viewed message.")
|
"*internal* The plist describing the currently viewed message.")
|
||||||
|
|
||||||
|
(defvar mu4e-captured-message nil
|
||||||
|
"*internal* the last-captured message (the s-expression).")
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; our handlers funcs
|
;; our handlers funcs
|
||||||
|
|||||||
Reference in New Issue
Block a user