X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=8db5435fb291b22abf1317ebed0c7e79c0cfd0aa;hb=e6d85fb97d86e103c2c62cd215f54a3fe37856d0;hp=f96743b08d37b597a856ff1a1803f1d325c8c602;hpb=580de27177de5cd6c5cbc9cc3759ce320216dd5b;p=notmuch diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index f96743b0..8db5435f 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -508,21 +508,26 @@ current buffer, if possible." 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) + (notmuch-show-insert-part-header nth declared-type content-type nil) + (let* ((message (car (plist-get part :content))) + (headers (plist-get message :headers)) + (body (car (plist-get message :body))) + (start (point))) + ;; 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))) + (notmuch-show-insert-headers (plist-get message :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)) + ;; Show the body + (notmuch-show-insert-bodypart msg body depth) + + (when notmuch-show-indent-multipart + (indent-rigidly start (point) 1))) t) (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth declared-type) @@ -775,8 +780,14 @@ current buffer, if possible." "Insert the forest of threads FOREST." (mapc '(lambda (thread) (notmuch-show-insert-thread thread 0)) forest)) +(defvar notmuch-show-thread-id nil) +(make-variable-buffer-local 'notmuch-show-thread-id) (defvar notmuch-show-parent-buffer nil) (make-variable-buffer-local 'notmuch-show-parent-buffer) +(defvar notmuch-show-query-context nil) +(make-variable-buffer-local 'notmuch-show-query-context) +(defvar notmuch-show-buffer-name nil) +(make-variable-buffer-local 'notmuch-show-buffer-name) ;;;###autoload (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch) @@ -796,17 +807,23 @@ which the message thread is shown. If it is nil (which occurs when the command is called interactively) the argument to the function is used. " (interactive "sNotmuch show: ") - (let ((buffer (get-buffer-create (generate-new-buffer-name - (or buffer-name - (concat "*notmuch-" thread-id "*"))))) - (process-crypto (if crypto-switch - (not notmuch-crypto-process-mime) - notmuch-crypto-process-mime)) - (inhibit-read-only t)) + (let* ((buffer-name (generate-new-buffer-name + (or buffer-name + (concat "*notmuch-" thread-id "*")))) + (buffer (get-buffer-create buffer-name)) + (process-crypto (if crypto-switch + (not notmuch-crypto-process-mime) + notmuch-crypto-process-mime)) + (inhibit-read-only t)) (switch-to-buffer buffer) (notmuch-show-mode) + + (setq notmuch-show-thread-id thread-id) (setq notmuch-show-parent-buffer parent-buffer) + (setq notmuch-show-query-context query-context) + (setq notmuch-show-buffer-name buffer-name) (setq notmuch-show-process-crypto process-crypto) + (erase-buffer) (goto-char (point-min)) (save-excursion @@ -839,6 +856,21 @@ function is used. " (notmuch-show-mark-read))) +(defun notmuch-show-refresh-view (&optional crypto-switch) + "Refresh the current view (with crypto switch if prefix given). + +Kills the current buffer and reruns notmuch show with the same +thread id. If a prefix is given, the current thread is +redisplayed with the crypto switch activated, which switch the +logic of the notmuch-crypto-process-mime customization variable." + (interactive "P") + (let ((thread-id notmuch-show-thread-id) + (parent-buffer notmuch-show-parent-buffer) + (query-context notmuch-show-query-context) + (buffer-name notmuch-show-buffer-name)) + (notmuch-kill-this-buffer) + (notmuch-show thread-id parent-buffer query-context buffer-name crypto-switch))) + (defvar notmuch-show-stash-map (let ((map (make-sparse-keymap))) (define-key map "c" 'notmuch-show-stash-cc) @@ -870,6 +902,7 @@ function is used. " (define-key map "V" 'notmuch-show-view-raw-message) (define-key map "v" 'notmuch-show-view-all-mime-parts) (define-key map "c" 'notmuch-show-stash-map) + (define-key map "=" 'notmuch-show-refresh-view) (define-key map "h" 'notmuch-show-toggle-headers) (define-key map "-" 'notmuch-show-remove-tag) (define-key map "+" 'notmuch-show-add-tag)