Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / dd / e999a76e674831f0343987ced48beb88c1a783
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5  by arlo.cworth.org (Postfix) with ESMTP id 3B1F66DE1B74\r
6  for <notmuch@notmuchmail.org>; Sat,  7 Nov 2015 03:05:06 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.204\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.204 tagged_above=-999 required=5 tests=[AWL=0.074, \r
12  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13  FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\r
14  RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]\r
15  autolearn=disabled\r
16 Received: from arlo.cworth.org ([127.0.0.1])\r
17  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
18  with ESMTP id ePV1OKWBiqmF for <notmuch@notmuchmail.org>;\r
19  Sat,  7 Nov 2015 03:05:04 -0800 (PST)\r
20 Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com\r
21  [74.125.82.44]) by arlo.cworth.org (Postfix) with ESMTPS id 4AA7C6DE199D for\r
22  <notmuch@notmuchmail.org>; Sat,  7 Nov 2015 03:04:53 -0800 (PST)\r
23 Received: by wmww144 with SMTP id w144so46070212wmw.1\r
24  for <notmuch@notmuchmail.org>; Sat, 07 Nov 2015 03:04:51 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26  h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
27  bh=nFOhLhaDucbDYlVZAxrmGPvt2GeuuPGKcfY9Fe9+hyk=;\r
28  b=HNoGQHHN2WzZsL+4jNoUgtJZNi8r5vLLmhHVyXsqhD/5HNPA84e15MO6dTd6tDpq83\r
29  q/YbGfaJRgrJHiAR9T/xyWEvBF854Bj190dFvOnF5sqnn0k4UmzrKby3/KG+Vbu8qmOQ\r
30  nvBdy0/vVYwmap/QDpjduuOs7UzCtSDx2RbHRtJ0a8h9rvEa1YTG+OSCRJ7j+u8EbBuF\r
31  40UNzcaj204Rs6U9QS3REQxaESFbWjoKSD+hapyNqMLwXQxuLw8hBCDTx8mdDKqHkyDS\r
32  b0uH3jHofX5jO3BwuUExbv4/LI/SGxIMVKTGh8s09DjQ+Dsnsu8Ybx757XjZazDZak8J\r
33  666g==\r
34 X-Received: by 10.28.210.77 with SMTP id j74mr14774901wmg.60.1446894291869;\r
35  Sat, 07 Nov 2015 03:04:51 -0800 (PST)\r
36 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
37  by smtp.gmail.com with ESMTPSA id gl4sm4522981wjd.49.2015.11.07.03.04.50\r
38  (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
39  Sat, 07 Nov 2015 03:04:50 -0800 (PST)\r
40 From: Mark Walters <markwalters1009@gmail.com>\r
41 To: notmuch@notmuchmail.org\r
42 Subject: [PATCH v4 5/7] emacs/show: Make the insertion of part headers\r
43  overridable.\r
44 Date: Sat,  7 Nov 2015 11:04:34 +0000\r
45 Message-Id: <1446894276-7814-6-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 2.1.4\r
47 In-Reply-To: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>\r
48 References: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.20\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53  <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
55  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
60  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Sat, 07 Nov 2015 11:05:06 -0000\r
62 \r
63 From: David Edmondson <dme@dme.org>\r
64 \r
65 This allows callers of notmuch-show-insert-bodypart to use a `let'\r
66 binding to override the default function for specifying when part\r
67 headers should be inserted.\r
68 ---\r
69  emacs/notmuch-show.el | 16 ++++++++++++----\r
70  1 file changed, 12 insertions(+), 4 deletions(-)\r
71 \r
72 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
73 index f8184e2..f4a65cc 100644\r
74 --- a/emacs/notmuch-show.el\r
75 +++ b/emacs/notmuch-show.el\r
76 @@ -945,8 +945,16 @@ (defun notmuch-show-mime-type (part)\r
77              "text/x-diff")\r
78         content-type)))\r
79  \r
80 +;; The following variable can be overridden by let bindings.\r
81 +(defvar notmuch-show-insert-header-p-function 'notmuch-show-insert-header-p\r
82 +  "Specify which function decides which part headers get inserted.\r
83 +\r
84 +The function should take two parameters, PART and HIDE, and\r
85 +should return non-NIL if a header button should be inserted for\r
86 +this part.")\r
87 +\r
88  (defun notmuch-show-insert-header-p (part hide)\r
89 -  "Return non-NIL if a header button should be inserted for this part."\r
90 +  ;; Show all part buttons except for the first part if it is text/plain.\r
91    (let ((mime-type (notmuch-show-mime-type part)))\r
92      (not (and (string= mime-type "text/plain")\r
93               (<= (plist-get part :id) 1)))))\r
94 @@ -965,9 +973,9 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
95                     (> notmuch-show-max-text-part-size 0)\r
96                     (> (length (plist-get part :content)) notmuch-show-max-text-part-size)))\r
97          (beg (point))\r
98 -        ;; We omit the part button for the first (or only) part if\r
99 -        ;; this is text/plain, or HIDE is 'no-buttons.\r
100 -        (button (when (notmuch-show-insert-header-p part hide)\r
101 +        ;; This default header-p function omits the part button for\r
102 +        ;; the first (or only) part if this is text/plain.\r
103 +        (button (when (funcall notmuch-show-insert-header-p-function part hide)\r
104                    (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))\r
105          ;; Hide the part initially if HIDE is t, or if it is too long\r
106          ;; and we have a button to allow toggling (thus reply which\r
107 -- \r
108 2.1.4\r
109 \r