From: Mark Walters Date: Sun, 14 Feb 2016 18:39:58 +0000 (+0000) Subject: [PATCH v5 6/7] emacs/mua: Let user specify which parts get a header in citations. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ed3f8d2a207db7a66a04bbca52b4574f5cd5439c;p=notmuch-archives.git [PATCH v5 6/7] emacs/mua: Let user specify which parts get a header in citations. --- diff --git a/b4/19f1138a29c17fd72a5e6ded7bc2f2b50333bd b/b4/19f1138a29c17fd72a5e6ded7bc2f2b50333bd new file mode 100644 index 000000000..f4732220b --- /dev/null +++ b/b4/19f1138a29c17fd72a5e6ded7bc2f2b50333bd @@ -0,0 +1,169 @@ +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 A4B666DE1AE1 + for ; Sun, 14 Feb 2016 10:40:28 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.247 +X-Spam-Level: +X-Spam-Status: No, score=-0.247 tagged_above=-999 required=5 tests=[AWL=0.323, + 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_DNSWL_LOW=-0.7, + 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 BztGXDzIMMIZ for ; + Sun, 14 Feb 2016 10:40:26 -0800 (PST) +Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com + [74.125.82.68]) by arlo.cworth.org (Postfix) with ESMTPS id 4E6446DE10C1 for + ; Sun, 14 Feb 2016 10:40:24 -0800 (PST) +Received: by mail-wm0-f68.google.com with SMTP id g62so12193406wme.2 + for ; Sun, 14 Feb 2016 10:40:24 -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=gR4Pj1W0tfGTQleSCmGyahj2v5hHtQ3Nh6BbHawCCV0=; + b=yC/ltf/HbW4VQpa+DjPZzGuvKauw0LfUf0tTAexe0lTGmk5YfbrjFX29/CxyXe6zaq + 8aGuxCb8zQGo/IzQrzMvuJx/06iHSnrJ/IjYO5GfnjNsG2rr0PSW3rU/qkIM8spuLLGj + 9p2qCsrO0hRMJzcdULzETEkTqQcI6fuV2mjvIawV3jz0oKaLLsVCd40Iw5hRg81d9ueM + Boe/wy1w3bg0diIdBVHlsmxZdSJTbB54phIPHrqeYdCHFrru7xhxhQCqQDPgjVZ3ysHz + HqTXBdcb02xk11IfmrMyWNAeSRGUwMeRCpNBx5BFnOzTGpJLtIXZUhw5+kCRUsDnxHZ+ + S8tA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references; + bh=gR4Pj1W0tfGTQleSCmGyahj2v5hHtQ3Nh6BbHawCCV0=; + b=X14xEjzzHmkp/BWvgUrlP6sY5mX7t/GH6DBYmYibCd48sc2RqVMzxg+gH+SZFMnNGB + /IkeUErE3WjQwl8RnSMAkgH5AHdN3+JFTDUaVKx5HtowsCY9JLHBW8iZG1aVYlP2Pr34 + 4acd+BpPsUsoxL9XtK5pSa99j8qoane7nnAf8bxYa89A8Zsu0pUdRZ9J9OW5sJo6fkAr + WyBZHcYHEqCsdfqnMHQuLDe/KcRY8JfU9tFb9GJUas7BAklYQ0c7jc/6chfqF4OnAHr6 + uVmiLprOlntxAS6dvEp3CAI8yYZYAm1T+Z/Q/rtFlO8QTjY0w8iAT1Ip1spnWnRBzfbH + Ctpg== +X-Gm-Message-State: + AG10YOT6d3U++MNY2ZLyY7bH1UU3cscTfoACu/k2B+FdnWRi6UsnbSPGNEd47p1HuuovTg== +X-Received: by 10.28.0.86 with SMTP id 83mr9154703wma.63.1455475223066; + Sun, 14 Feb 2016 10:40:23 -0800 (PST) +Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) + by smtp.gmail.com with ESMTPSA id uo9sm21731546wjc.49.2016.02.14.10.40.22 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 14 Feb 2016 10:40:22 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v5 6/7] emacs/mua: Let user specify which parts get a header + in citations. +Date: Sun, 14 Feb 2016 18:39:58 +0000 +Message-Id: <1455475199-32622-7-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: <1455475199-32622-1-git-send-email-markwalters1009@gmail.com> +References: <1455475199-32622-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: Sun, 14 Feb 2016 18:40:28 -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 a386d43..fcb3e95 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 () +@@ -223,10 +240,15 @@ Note that these functions use `mail-citation-hook' if that is non-nil." + (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 5654d11..ec58cac 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -957,6 +957,19 @@ this part.") + (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 +