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

Mark Walters markwalters1009 at gmail.com
Tue Feb 9 14:35:58 PST 2016


On Tue, 09 Feb 2016, David Edmondson <dme at dme.org> wrote:
> On Sat, Nov 07 2015, Mark Walters wrote:
>> 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.
>> ---
>>  emacs/notmuch-mua.el  | 30 ++++++++++++++++++++++++++----
>>  emacs/notmuch-show.el | 13 +++++++++++++
>>  2 files changed, 39 insertions(+), 4 deletions(-)
>>
>> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
>> index 2f7abb0..a675f47 100644
>> --- a/emacs/notmuch-mua.el
>> +++ b/emacs/notmuch-mua.el
>> @@ -91,6 +91,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)
>> +
>
> These are all functions - should we be `declare-function'ing them, given
> that they come from elsewhere? Presumably the compiler is not clever
> enough to complain if we don't.

Hi,

The compiler doesn't seem to complain. But I don't know if we should
have the declare functions anyway? Any thoughts?

Best wishes

Mark

>
>>  ;;
>>  
>>  (defun notmuch-mua-get-switch-function ()
>> @@ -221,10 +238,15 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)
>>  	(insert "Date: " date "\n\n")
>>  
>>  	(insert (with-temp-buffer
>> -		  ;; Don't attempt to clean up messages, excerpt
>> -		  ;; citations, etc. in the original message before
>> -		  ;; quoting.
>> -		  (let ((notmuch-show-insert-text/plain-hook nil))
>> +		  (let
>> +		      ;; Don't attempt to clean up messages, excerpt
>> +		      ;; citations, etc. in the original message before
>> +		      ;; quoting.
>> +		      ((notmuch-show-insert-text/plain-hook 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-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 f4a65cc..7ff9ed5 100644
>> --- a/emacs/notmuch-show.el
>> +++ b/emacs/notmuch-show.el
>> @@ -959,6 +959,19 @@ (defun notmuch-show-insert-header-p (part hide)
>>      (not (and (string= mime-type "text/plain")
>>  	      (<= (plist-get part :id) 1)))))
>>  
>> +(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.
>>  
>> -- 
>> 2.1.4


More information about the notmuch mailing list