[PATCH v6 6/6] emacs/mua: Let user specify which parts get a header in citations.

Jani Nikula jani at nikula.org
Mon Mar 7 09:17:00 PST 2016


On Sat, 20 Feb 2016, Mark Walters <markwalters1009 at gmail.com> wrote:
> [ text/plain ]

This patch (or, bisected commit d27d90875dfb emacs/mua: Let user specify
which parts get a header in citations.) causes the above to be added to
all replies. Why?

I don't understand what "header" the patch is talking about. If it's the
[ text/plain ] above and it's intentional, *shudder*. Who would want
that?

BR,
Jani.


> From: David Edmondson <dme at dme.org>
>
> 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.
> ---
>  emacs/notmuch-mua.el  | 19 ++++++++++++++++++-
>  emacs/notmuch-show.el | 10 ++++++++++
>  test/test-lib.el      |  4 ++++
>  3 files changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index ecc5bec..fcb3e95 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -93,6 +93,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original
>    :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 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)
>  		       ;; 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 2a81ec1..371e62d 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -954,6 +954,16 @@ (defun notmuch-show-insert-header-p (part hide)
>  (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 596a705..02e020c 100644
> --- a/test/test-lib.el
> +++ b/test/test-lib.el
> @@ -184,6 +184,10 @@ (defmacro notmuch-test-progn (&rest body)
>  (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
>  
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list