From 92336ed5cf1559a6e696cda9e351292fe24e7450 Mon Sep 17 00:00:00 2001 From: David Edmondson Date: Tue, 9 Feb 2016 20:34:16 +0000 Subject: [PATCH] Re: [PATCH v4 6/7] emacs/mua: Let user specify which parts get a header in citations. --- b0/17a2b20670ca8341f2259c47b3eb0f12c0d1db | 181 ++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 b0/17a2b20670ca8341f2259c47b3eb0f12c0d1db diff --git a/b0/17a2b20670ca8341f2259c47b3eb0f12c0d1db b/b0/17a2b20670ca8341f2259c47b3eb0f12c0d1db new file mode 100644 index 000000000..5fd5bdcc4 --- /dev/null +++ b/b0/17a2b20670ca8341f2259c47b3eb0f12c0d1db @@ -0,0 +1,181 @@ +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 E34C06DE1765 + for ; Tue, 9 Feb 2016 12:34:21 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.091 +X-Spam-Level: +X-Spam-Status: No, score=-0.091 tagged_above=-999 required=5 + tests=[AWL=-0.024, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=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 h0PXWBRcJT_i for ; + Tue, 9 Feb 2016 12:34:19 -0800 (PST) +Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com + [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id 7D6266DE01D3 for + ; Tue, 9 Feb 2016 12:34:19 -0800 (PST) +Received: by mail-wm0-f65.google.com with SMTP id g62so2573wme.2 + for ; Tue, 09 Feb 2016 12:34:19 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=dme-org.20150623.gappssmtp.com; s=20150623; + h=to:subject:in-reply-to:references:from:date:message-id:mime-version + :content-type; bh=7X00I8Jju9Q7iaCL8m0I5lcpruVckpPINYXojOe+okg=; + b=xbwKS4DZ9hwtf9rGnl2IBrWgZ1PhJieLcLt7fZ0b3a4eLS7gUIp2SUlSY26UxB2bmQ + S3wHh7Caoa5iPN9jYwlNud7WWg/F2KWp+swib6hLCecReiaxe19G7iRO6ZKKO7/LvJ0m + FLHdwm3SyB+sXV4je2d8WTVdE3IzRn6li7HJuok8iU7YdKXRu3HFNBYumnZG6SJMgoem + dTP+5vtNE7CRtPzHVz9fJMN3o7UFB43VQ8NPcFVXEC6E0cTbkUnNvzSIpmTk5ZF0Am8w + nwc9vaGZfz2+vmLa8YLhbbFJvohIyyWO2pUit70lPIcJjn7Wy4orKDwTry8/t+Ot5iS/ + 9Ueg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:to:subject:in-reply-to:references:from:date + :message-id:mime-version:content-type; + bh=7X00I8Jju9Q7iaCL8m0I5lcpruVckpPINYXojOe+okg=; + b=eyIzx698p5NMWCUMCC9m1C6yjbCzAWwFiA1iw31S6+ulF4q8ZU6XMz8Civ1RG3NbUF + LB8NE7aad/aUTNy+jxqUJwnpM8tBzg5jomW3QvTLK3WHTq97vHn3FupmZHh1bCKZndi0 + 2ux2QNZxY9JZv8VAME1r7BcMVV7gFL06GEbQP7t1hLCFD8EVhMsW3X9N+NWbRTKzowvj + lGxe5KhCKJ17++35xNhpw5XD+VcbtW4VMcR70XMusw01WHdEtzaUlJ8epjIPFlHjFRG7 + rseC36AXoi1h6dUyPE4fOgTB9A10LBT4zhiseAyV1UaXYKN/Ge7y2gfY+Fl9llTXyJRA + T75w== +X-Gm-Message-State: + AG10YOQMt3j8QHZUIxAX42YUiRNDkkOSe8GybpLzaKiP65Z61LP/tsWvTwTSerauodX5kQ== +X-Received: by 10.28.174.72 with SMTP id x69mr6828563wme.68.1455050058217; + Tue, 09 Feb 2016 12:34:18 -0800 (PST) +Received: from disaster-area.hh.sledj.net + ([2a01:348:1a2:1:ea39:35ff:fe2c:a227]) + by smtp.gmail.com with ESMTPSA id w8sm36318414wjx.21.2016.02.09.12.34.16 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Tue, 09 Feb 2016 12:34:16 -0800 (PST) +Received: from localhost (disaster-area.hh.sledj.net [local]) + by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 05b79c16; + Tue, 9 Feb 2016 20:34:16 +0000 (UTC) +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH v4 6/7] emacs/mua: Let user specify which parts get a + header in citations. +In-Reply-To: <1446894276-7814-7-git-send-email-markwalters1009@gmail.com> +References: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com> + <1446894276-7814-7-git-send-email-markwalters1009@gmail.com> +From: David Edmondson +Date: Tue, 09 Feb 2016 20:34:16 +0000 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain +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: Tue, 09 Feb 2016 20:34:22 -0000 + +On Sat, Nov 07 2015, Mark Walters wrote: +> 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) +> + + +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. + +> ;; +> +> (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 -- 2.26.2