mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
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.
This commit is contained in:
parent
adefa734e3
commit
d27d90875d
3 changed files with 32 additions and 1 deletions
|
@ -93,6 +93,23 @@ Note that these functions use `mail-citation-hook' if that is non-nil."
|
||||||
:link '(custom-manual "(message)Insertion Variables")
|
:link '(custom-manual "(message)Insertion Variables")
|
||||||
:group 'notmuch-reply)
|
: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 ()
|
(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.
|
;; Don't omit long parts.
|
||||||
(notmuch-show-max-text-part-size 0)
|
(notmuch-show-max-text-part-size 0)
|
||||||
;; Insert headers for parts as appropriate for replying.
|
;; 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)
|
(notmuch-show-insert-body original (plist-get original :body) 0)
|
||||||
(buffer-substring-no-properties (point-min) (point-max)))))
|
(buffer-substring-no-properties (point-min) (point-max)))))
|
||||||
|
|
||||||
|
|
|
@ -954,6 +954,16 @@ this part.")
|
||||||
(defun notmuch-show-reply-insert-header-p-never (part hide)
|
(defun notmuch-show-reply-insert-header-p-never (part hide)
|
||||||
nil)
|
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)
|
(defun notmuch-show-insert-bodypart (msg part depth &optional hide)
|
||||||
"Insert the body part PART at depth DEPTH in the current thread.
|
"Insert the body part PART at depth DEPTH in the current thread.
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,10 @@ nothing."
|
||||||
(setq notmuch-tag-deleted-formats
|
(setq notmuch-tag-deleted-formats
|
||||||
'((".*" nil)))
|
'((".*" 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
|
;; force a common html renderer, to avoid test variations between
|
||||||
;; environments
|
;; environments
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue