diff --git a/mu4e/mu4e-message.el b/mu4e/mu4e-message.el index 587a5183..2cbfd5ec 100644 --- a/mu4e/mu4e-message.el +++ b/mu4e/mu4e-message.el @@ -178,8 +178,10 @@ be changed by setting `mu4e-view-prefer-html'." (insert html) (cond ((stringp mu4e-html2text-command) - (shell-command-on-region (point-min) (point-max) - mu4e-html2text-command nil t)) + (let* ((tmp-file (make-temp-file "mu4e-html"))) + (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) (funcall mu4e-html2text-command)) (t (mu4e-error "Invalid `mu4e-html2text-command'"))) diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 0c9cfc34..a72529eb 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -105,6 +105,7 @@ The first letter of NAME is used as a shortcut character.") (defvar mu4e-view-attachment-actions '( ("wopen-with" . mu4e-view-open-attachment-with) ("ein-emacs" . mu4e-view-open-attachment-emacs) + ("dimport-in-diary" . mu4e-view-import-attachment-diary) ("|pipe" . mu4e-view-pipe-attachment)) "List of actions to perform on message attachments. 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))) (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) "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 ;; sense to edit the temp buffer; use C-x C-q if you insist... (setq buffer-read-only t)) + ((string= what "diary") + (icalendar-import-file path diary-file)) (t (mu4e-error "Unsupported action %S" what)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;