Merge pull request #574 from jeansch/master
mu4e: Added action to import attachment in diary. Better handle encoding while sending html to html2text.
This commit is contained in:
@ -178,8 +178,10 @@ be changed by setting `mu4e-view-prefer-html'."
|
|||||||
(insert html)
|
(insert html)
|
||||||
(cond
|
(cond
|
||||||
((stringp mu4e-html2text-command)
|
((stringp mu4e-html2text-command)
|
||||||
(shell-command-on-region (point-min) (point-max)
|
(let* ((tmp-file (make-temp-file "mu4e-html")))
|
||||||
mu4e-html2text-command nil t))
|
(write-region (point-min) (point-max) tmp-file)
|
||||||
|
(mu4e-process-file-through-pipe tmp-file mu4e-html2text-command)
|
||||||
|
(delete-file tmp-file)))
|
||||||
((functionp mu4e-html2text-command)
|
((functionp mu4e-html2text-command)
|
||||||
(funcall mu4e-html2text-command))
|
(funcall mu4e-html2text-command))
|
||||||
(t (mu4e-error "Invalid `mu4e-html2text-command'")))
|
(t (mu4e-error "Invalid `mu4e-html2text-command'")))
|
||||||
|
|||||||
@ -105,6 +105,7 @@ The first letter of NAME is used as a shortcut character.")
|
|||||||
(defvar mu4e-view-attachment-actions
|
(defvar mu4e-view-attachment-actions
|
||||||
'( ("wopen-with" . mu4e-view-open-attachment-with)
|
'( ("wopen-with" . mu4e-view-open-attachment-with)
|
||||||
("ein-emacs" . mu4e-view-open-attachment-emacs)
|
("ein-emacs" . mu4e-view-open-attachment-emacs)
|
||||||
|
("dimport-in-diary" . mu4e-view-import-attachment-diary)
|
||||||
("|pipe" . mu4e-view-pipe-attachment))
|
("|pipe" . mu4e-view-pipe-attachment))
|
||||||
"List of actions to perform on message attachments.
|
"List of actions to perform on message attachments.
|
||||||
The actions are cons-cells of the form:
|
The actions are cons-cells of the form:
|
||||||
@ -1136,6 +1137,12 @@ If PIPECMD is nil, ask user for it."
|
|||||||
(index (plist-get att :index)))
|
(index (plist-get att :index)))
|
||||||
(mu4e~view-temp-action (mu4e-message-field msg :docid) index "emacs")))
|
(mu4e~view-temp-action (mu4e-message-field msg :docid) index "emacs")))
|
||||||
|
|
||||||
|
(defun mu4e-view-import-attachment-diary (msg attachnum)
|
||||||
|
"Open MSG's attachment ATTACHNUM in the current emacs instance."
|
||||||
|
(interactive)
|
||||||
|
(let* ((att (mu4e~view-get-attach msg attachnum))
|
||||||
|
(index (plist-get att :index)))
|
||||||
|
(mu4e~view-temp-action (mu4e-message-field msg :docid) index "diary")))
|
||||||
|
|
||||||
(defun mu4e-view-attachment-action (&optional msg)
|
(defun mu4e-view-attachment-action (&optional msg)
|
||||||
"Ask user what to do with attachments in MSG
|
"Ask user what to do with attachments in MSG
|
||||||
@ -1174,6 +1181,8 @@ attachments) in response to a (mu4e~proc-extract 'temp ... )."
|
|||||||
;; make the buffer read-only since it usually does not make
|
;; make the buffer read-only since it usually does not make
|
||||||
;; sense to edit the temp buffer; use C-x C-q if you insist...
|
;; sense to edit the temp buffer; use C-x C-q if you insist...
|
||||||
(setq buffer-read-only t))
|
(setq buffer-read-only t))
|
||||||
|
((string= what "diary")
|
||||||
|
(icalendar-import-file path diary-file))
|
||||||
(t (mu4e-error "Unsupported action %S" what))))
|
(t (mu4e-error "Unsupported action %S" what))))
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user