Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 01 / cdec53eaaf507fb77a1e83ac3d0645a4aad4b7
1 Return-Path: <dme@dme.org>\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 632466DE13A6\r
6  for <notmuch@notmuchmail.org>; Tue,  9 Feb 2016 12:28:44 -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.069\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.069 tagged_above=-999 required=5\r
12  tests=[AWL=-0.002, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,\r
13  RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
14  RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=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 TbQVHJ5cBmqP for <notmuch@notmuchmail.org>;\r
19  Tue,  9 Feb 2016 12:28:42 -0800 (PST)\r
20 Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com\r
21  [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id 2CA886DE01D3 for\r
22  <notmuch@notmuchmail.org>; Tue,  9 Feb 2016 12:28:42 -0800 (PST)\r
23 Received: by mail-wm0-f65.google.com with SMTP id 128so30413wmz.3\r
24  for <notmuch@notmuchmail.org>; Tue, 09 Feb 2016 12:28:42 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26  d=dme-org.20150623.gappssmtp.com; s=20150623;\r
27  h=to:subject:in-reply-to:references:from:date:message-id:mime-version\r
28  :content-type; bh=a5qY8PX+8mdfx948wkY3RPM7iQ1WDROD/w5EDqcDsJo=;\r
29  b=Bp0lK6yNYC3Gb3LOLhJTyBqHmL9eIDCdYyPgo0dJnL/qRljQaDLYS0jeHOrlMOl+Zx\r
30  MsQrT68y1lZSuh4klCUa93UGuNyqSMX2guZ3lBRv1EpJNSlFynHonEAH8jSBy4J5ZiVK\r
31  gRDjXDxxhnaeBZIDvWC1cmb20GMyFJAc7w8shsMkzBnFtrqAAVecxsRq/t4wPG6KAVDZ\r
32  nv64k/CNYOudQswtmn6J9/vOBqYhanBNyXgf1ZoAcZWasarNv/lTh/8nO62l9dxafWa5\r
33  Xt5qHFbDQgqFM/DlnlUYuHdiuB0tpoG1TLAVgTuNRRrR34Dxva9Nhwxroxiyibijcf1m\r
34  2L0A==\r
35 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
36  d=1e100.net; s=20130820;\r
37  h=x-gm-message-state:to:subject:in-reply-to:references:from:date\r
38  :message-id:mime-version:content-type;\r
39  bh=a5qY8PX+8mdfx948wkY3RPM7iQ1WDROD/w5EDqcDsJo=;\r
40  b=KWtr1IuPXTIPGbIR8Wpuzqkswx8ZaXW9YJNIC3+qYkdmzHVcafa7BtyFNev8zQd22p\r
41  I1YInVnLa8E7N7+z8hLDp8VDbiR2ZHjkIoT88ldRl9qzLjey3aTdao4Kb9tYVAXZ76uT\r
42  OpsNT6+8sP0f5N0fld6NW6Uhufjyc20gEqTWcP4BE6gzXOtMhBUZsBvM9lFsF4V2w9Sp\r
43  rHuxuTPTk70JzrVKNowXUr6hPPhtUkVwsCu5Dj7LK6QJd0VXitSVyP4YM90dB/qL4gW1\r
44  BerNWacrEEBCyllkj04l9plfUJcaYlyIYtAjy//A6P1Vr9r4tTQowOtTsCwsXnctyV67\r
45  UYwg==\r
46 X-Gm-Message-State:\r
47  AG10YORc24I6AZCkjzevYxXVEwTFBNWhelT/zhtp1cwZ+AWHDjdsAFzbmG1XnNqWtgfU7g==\r
48 X-Received: by 10.28.131.134 with SMTP id f128mr7160601wmd.41.1455049720860;\r
49  Tue, 09 Feb 2016 12:28:40 -0800 (PST)\r
50 Received: from disaster-area.hh.sledj.net\r
51  ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
52  by smtp.gmail.com with ESMTPSA id c136sm19053937wmd.3.2016.02.09.12.28.39\r
53  (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
54  Tue, 09 Feb 2016 12:28:39 -0800 (PST)\r
55 Received: from localhost (disaster-area.hh.sledj.net [local])\r
56  by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 6601a644;\r
57  Tue, 9 Feb 2016 20:28:38 +0000 (UTC)\r
58 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
59 Subject: Re: [PATCH v4 1/7] emacs/show: Re-arrange determination if a part\r
60  header is necessary\r
61 In-Reply-To: <1446894276-7814-2-git-send-email-markwalters1009@gmail.com>\r
62 References: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>\r
63  <1446894276-7814-2-git-send-email-markwalters1009@gmail.com>\r
64 From: David Edmondson <dme@dme.org>\r
65 Date: Tue, 09 Feb 2016 20:28:38 +0000\r
66 Message-ID: <m2fux14oi1.fsf@dme.org>\r
67 MIME-Version: 1.0\r
68 Content-Type: text/plain\r
69 X-BeenThere: notmuch@notmuchmail.org\r
70 X-Mailman-Version: 2.1.20\r
71 Precedence: list\r
72 List-Id: "Use and development of the notmuch mail system."\r
73  <notmuch.notmuchmail.org>\r
74 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
75  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
76 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
77 List-Post: <mailto:notmuch@notmuchmail.org>\r
78 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
79 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
80  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
81 X-List-Received-Date: Tue, 09 Feb 2016 20:28:44 -0000\r
82 \r
83 On Sat, Nov 07 2015, Mark Walters wrote:\r
84 > From: David Edmondson <dme@dme.org>\r
85 >\r
86 > Move the determination of whether a part header is required to a\r
87 > distinct function.\r
88 > ---\r
89 >  emacs/notmuch-show.el | 25 ++++++++++++++++++-------\r
90 >  1 file changed, 18 insertions(+), 7 deletions(-)\r
91 >\r
92 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
93 > index 49fd198..47a02e5 100644\r
94 > --- a/emacs/notmuch-show.el\r
95 > +++ b/emacs/notmuch-show.el\r
96 > @@ -929,6 +929,21 @@ (defun notmuch-show-lazy-part (part-args button)\r
97 >        ;; showable this returns nil.\r
98 >        (notmuch-show-create-part-overlays button part-beg part-end))))\r
99 >  \r
100 > +(defun notmuch-show-mime-type (part)\r
101 > +  "Return the correct mime-type to use for PART."\r
102 > +  (let ((content-type (downcase (plist-get part :content-type))))\r
103 > +    (or (and (string= content-type "application/octet-stream")\r
104 > +          (notmuch-show-get-mime-type-of-application/octet-stream part))\r
105 > +     (and (string= content-type "inline patch")\r
106 > +          "text/x-diff")\r
107 > +     content-type)))\r
108 > +\r
109 > +(defun notmuch-show-insert-header-p (part hide)\r
110 > +  "Return non-NIL if a header button should be inserted for this part."\r
111 > +  (let ((mime-type (notmuch-show-mime-type part)))\r
112 > +    (not (and (string= mime-type "text/plain")\r
113 > +           (<= (plist-get part :id) 1)))))\r
114 \r
115 It would be nice to have a comment here that explained the logic being\r
116 applied (i.e. parts get a header unless they are text/plain and the\r
117 first part). (It actually took me a minute to figure out what the logic\r
118 was...)\r
119 \r
120 > +\r
121 >  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
122 >    "Insert the body part PART at depth DEPTH in the current thread.\r
123 >  \r
124 > @@ -939,11 +954,7 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
125 >  useful for quoting in replies)."\r
126 >  \r
127 >    (let* ((content-type (downcase (plist-get part :content-type)))\r
128 > -      (mime-type (or (and (string= content-type "application/octet-stream")\r
129 > -                          (notmuch-show-get-mime-type-of-application/octet-stream part))\r
130 > -                     (and (string= content-type "inline patch")\r
131 > -                          "text/x-diff")\r
132 > -                     content-type))\r
133 > +      (mime-type (notmuch-show-mime-type part))\r
134 >        (nth (plist-get part :id))\r
135 >        (long (and (notmuch-match-content-type mime-type "text/*")\r
136 >                   (> notmuch-show-max-text-part-size 0)\r
137 > @@ -951,8 +962,8 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
138 >        (beg (point))\r
139 >        ;; We omit the part button for the first (or only) part if\r
140 >        ;; this is text/plain, or HIDE is 'no-buttons.\r
141 \r
142 Part of this comment now belongs up above.\r
143 \r
144 > -      (button (unless (or (equal hide 'no-buttons)\r
145 > -                          (and (string= mime-type "text/plain") (<= nth 1)))\r
146 > +      (button (when (and (not (equal hide 'no-buttons))\r
147 > +                         (notmuch-show-insert-header-p part hide))\r
148 >                  (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))\r
149 >        ;; Hide the part initially if HIDE is t, or if it is too long\r
150 >        ;; and we have a button to allow toggling (thus reply which\r
151 > -- \r
152 > 2.1.4\r