X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=e08497d98b089486efd792c702182c2808d984dc;hb=b741e4dd25d2a25d2ba1cbdbfc4ffbaa8b95223d;hp=3a60d4308470c5643975741d21912c4ac49d89bc;hpb=75d616c6caa0e0ac51c34371ebee7574dbea2952;p=notmuch diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 3a60d430..e08497d9 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -280,6 +280,48 @@ current buffer, if possible." t) nil))))) +(defun notmuch-show-insert-part-multipart/alternative (msg part content-type nth depth declared-type) + (let ((inner-parts (plist-get part :content))) + (notmuch-show-insert-part-header nth declared-type content-type nil) + ;; In most cases, multipart/alternative is used to provide both + ;; text/plain and text/html (or multipart/related with text/html + ;; and image/*) parts. We might allow the user to express a + ;; preference about which part to show, but for the moment we just + ;; choose the first. This is usually the text/plain part. + (notmuch-show-insert-bodypart msg (car inner-parts) depth) + (mapc (lambda (inner-part) + (let ((inner-type (concat (plist-get inner-part :content-type) " (not shown)"))) + (notmuch-show-insert-part-header (plist-get inner-part :id) inner-type inner-type nil))) + (cdr inner-parts))) + t) + +(defun notmuch-show-insert-part-multipart/* (msg part content-type nth depth declared-type) + (let ((inner-parts (plist-get part :content))) + (notmuch-show-insert-part-header nth declared-type content-type nil) + ;; Show all of the parts. + (mapc (lambda (inner-part) + (notmuch-show-insert-bodypart msg inner-part depth)) + inner-parts)) + t) + +(defun notmuch-show-insert-part-message/rfc822 (msg part content-type nth depth declared-type) + (let* ((message-part (plist-get part :content)) + (inner-parts (plist-get message-part :content))) + (notmuch-show-insert-part-header nth declared-type content-type nil) + ;; Override `notmuch-message-headers' to force `From' to be + ;; displayed. + (let ((notmuch-message-headers '("From" "Subject" "To" "Cc" "Date"))) + (notmuch-show-insert-headers (plist-get part :headers))) + ;; Blank line after headers to be compatible with the normal + ;; message display. + (insert "\n") + + ;; Show all of the parts. + (mapc (lambda (inner-part) + (notmuch-show-insert-bodypart msg inner-part depth)) + inner-parts)) + t) + (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth declared-type) (let ((start (point))) ;; If this text/plain part is not the first part in the message, @@ -948,7 +990,7 @@ any effects from previous calls to The given command will be executed with the raw contents of the current email message as stdin. Anything printed by the command -to stdout or stderr will appear in the *Messages* buffer. +to stdout or stderr will appear in the *notmuch-pipe* buffer. When invoked with a prefix argument, the command will receive all open messages in the current thread (formatted as an mbox) rather @@ -964,7 +1006,18 @@ than only the current message." (setq shell-command (concat notmuch-command " show --format=raw " (shell-quote-argument (notmuch-show-get-message-id)) " | " command))) - (start-process-shell-command "notmuch-pipe-command" "*notmuch-pipe*" shell-command))) + (let ((buf (get-buffer-create (concat "*notmuch-pipe*")))) + (with-current-buffer buf + (setq buffer-read-only nil) + (erase-buffer) + (let ((exit-code (call-process-shell-command shell-command nil buf))) + (goto-char (point-max)) + (set-buffer-modified-p nil) + (setq buffer-read-only t) + (unless (zerop exit-code) + (switch-to-buffer-other-window buf) + (message (format "Command '%s' exited abnormally with code %d" + shell-command exit-code)))))))) (defun notmuch-show-add-tags-worker (current-tags add-tags) "Add to `current-tags' with any tags from `add-tags' not