Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 1653A6DE199D for ; Sat, 7 Nov 2015 03:05:07 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.204 X-Spam-Level: X-Spam-Status: No, score=0.204 tagged_above=-999 required=5 tests=[AWL=0.074, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4A70BRKMDcnx for ; Sat, 7 Nov 2015 03:05:05 -0800 (PST) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by arlo.cworth.org (Postfix) with ESMTPS id 2CC116DE170E for ; Sat, 7 Nov 2015 03:04:55 -0800 (PST) Received: by wmnn186 with SMTP id n186so60910668wmn.1 for ; Sat, 07 Nov 2015 03:04:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3y7zFNfOMVRgGPwSbevgO8BJ5NGj7loC6K7g8sSjHvk=; b=LABkj75eUmjTN2K5FnXOxjwXvWlyNkfJ2oy36WGtTV/8O0Kd6o30/X/4s7AKeb2kj7 f9xTzB/axmvnKSLaojsNR58h8aHPqjqb4PhkVW/m2wflV/GQbnjZF7XpLs0HPamKKojr Eg3FyKf0Zh3/T67bJPBNFsX9RnaV58aUf2KH4Lclxqg/iNPCyff1B93Eu2H2t0diadkT Kh608wXLD0zIUi+NCdsb4jsSKCXQb6a12JmUvVxi1bTz1bFywtX4u12sHolfXXBRereY UHCjnHdFEm26UEX5qVclvr6Oq3iR3Bu3qobD70mJnKGVT4ZsUBUBrDxd8ZI/Tm9SvIyW vsJQ== X-Received: by 10.28.143.1 with SMTP id r1mr15972715wmd.80.1446894293740; Sat, 07 Nov 2015 03:04:53 -0800 (PST) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by smtp.gmail.com with ESMTPSA id 186sm3443760wmp.10.2015.11.07.03.04.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Nov 2015 03:04:52 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations. Date: Sat, 7 Nov 2015 11:04:35 +0000 Message-Id: <1446894276-7814-7-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com> References: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2015 11:05:07 -0000 From: David Edmondson 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) + ;; (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