X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=94d94ed235b3d877123739e39f40f6bdcdb0692f;hp=e6a5b31fee3c0f3d820d973d029204248429a6d0;hb=3f003a3ae0ee800cbbae7ac1daa72b3be55f9d83;hpb=37dec7d7b37afd281f23c0ec7ed9111c24965126 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index e6a5b31f..94d94ed2 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -71,9 +71,10 @@ any given message." "A list of functions called to decorate the headers listed in `notmuch-message-headers'.") -(defcustom notmuch-show-hook nil +(defcustom notmuch-show-hook '(notmuch-show-turn-on-visual-line-mode) "Functions called after populating a `notmuch-show' buffer." :type 'hook + :options '(notmuch-show-turn-on-visual-line-mode) :group 'notmuch-show :group 'notmuch-hooks) @@ -133,6 +134,10 @@ indentation." ,@body) (kill-buffer buf))))) +(defun notmuch-show-turn-on-visual-line-mode () + "Enable Visual Line mode." + (visual-line-mode t)) + (defun notmuch-show-view-all-mime-parts () "Use external viewers to view all attachments from the current message." (interactive) @@ -429,14 +434,15 @@ current buffer, if possible." (with-temp-buffer (let* ((charset (plist-get part :content-charset)) (handle (mm-make-handle (current-buffer) `(,content-type (charset . ,charset))))) - (if (and (mm-inlinable-p handle) - (mm-inlined-p handle)) - (let ((content (notmuch-show-get-bodypart-content msg part nth))) - (insert content) - (set-buffer display-buffer) - (mm-display-part handle) - t) - nil))))) + ;; If the user wants the part inlined, insert the content and + ;; test whether we are able to inline it (which includes both + ;; capability and suitability tests). + (when (mm-inlined-p handle) + (insert (notmuch-show-get-bodypart-content msg part nth)) + (when (mm-inlinable-p handle) + (set-buffer display-buffer) + (mm-display-part handle) + t)))))) (defvar notmuch-show-multipart/alternative-discouraged '(