From: David Edmondson Date: Sat, 20 Feb 2016 18:24:40 +0000 (+0000) Subject: emacs/mua: Let user specify which parts get a header in citations. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d27d90875dfb16720de624a57387451665882c19;p=notmuch.git emacs/mua: Let user specify which parts get a header in citations. Add a customizable function specifying which parts get a header when replying, and give some sensible possiblities. These are, 1) all parts except multipart/*. (Subparts of a multipart part do receive a header button.) 2) only included text/* parts. 3) Exactly as in the show buffer. 4) None at all. This means the reply contains a mish-mash of all the original message's parts. In the test suite we set the choice to option 4 to match the previous behaviour. --- diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index ecc5bece..fcb3e951 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -93,6 +93,23 @@ Note that these functions use `mail-citation-hook' if that is non-nil." :link '(custom-manual "(message)Insertion Variables") :group 'notmuch-reply) +(defcustom notmuch-mua-reply-insert-header-p-function + 'notmuch-show-reply-insert-header-p-trimmed + "Function to decide which parts get a header when replying. + +This function specifies which parts of a mime message with +mutiple parts get a header." + :type '(radio (const :tag "All except multipart/* and hidden parts" + notmuch-show-reply-insert-header-p-trimmed) + (const :tag "Only for included text parts" + notmuch-show-reply-insert-header-p-minimal) + (const :tag "Exactly as in show view" + notmuch-show-insert-header-p) + (const :tag "No part headers" + notmuch-show-reply-insert-header-p-never) + (function :tag "Other")) + :group 'notmuch-reply) + ;; (defun notmuch-mua-get-switch-function () @@ -231,7 +248,7 @@ Note that these functions use `mail-citation-hook' if that is non-nil." ;; Don't omit long parts. (notmuch-show-max-text-part-size 0) ;; Insert headers for parts as appropriate for replying. - (notmuch-show-insert-header-p-function #'notmuch-show-reply-insert-header-p-never)) + (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function)) (notmuch-show-insert-body original (plist-get original :body) 0) (buffer-substring-no-properties (point-min) (point-max))))) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 2a81ec1f..371e62df 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -954,6 +954,16 @@ this part.") (defun notmuch-show-reply-insert-header-p-never (part hide) nil) +(defun notmuch-show-reply-insert-header-p-trimmed (part hide) + (let ((mime-type (notmuch-show-mime-type part))) + (and (not (notmuch-match-content-type mime-type "multipart/*")) + (not hide)))) + +(defun notmuch-show-reply-insert-header-p-minimal (part hide) + (let ((mime-type (notmuch-show-mime-type part))) + (and (notmuch-match-content-type mime-type "text/*") + (not hide)))) + (defun notmuch-show-insert-bodypart (msg part depth &optional hide) "Insert the body part PART at depth DEPTH in the current thread. diff --git a/test/test-lib.el b/test/test-lib.el index 596a7051..02e020c1 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -184,6 +184,10 @@ nothing." (setq notmuch-tag-deleted-formats '((".*" nil))) +;; For historical reasonse we don't print part headers when replying +;; in the tests suite +(setq notmuch-mua-reply-insert-header-p-function 'notmuch-show-reply-insert-header-p-never) + ;; force a common html renderer, to avoid test variations between ;; environments