"snoozing" with notmuch?
[notmuch-archives.git] / 84 / 66ef22a5f17f083cd90f39a3c28975f78ee217
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 olra.theworths.org (Postfix) with ESMTP id 95B03429E43\r
6         for <notmuch@notmuchmail.org>; Fri, 31 May 2013 11:27:41 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id j4eOyHN4WAki for <notmuch@notmuchmail.org>;\r
18         Fri, 31 May 2013 11:27:36 -0700 (PDT)\r
19 Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com\r
20         [209.85.212.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id DAABD431FDA\r
23         for <notmuch@notmuchmail.org>; Fri, 31 May 2013 11:27:22 -0700 (PDT)\r
24 Received: by mail-wi0-f172.google.com with SMTP id m6so967961wiv.17\r
25         for <notmuch@notmuchmail.org>; Fri, 31 May 2013 11:27:21 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=xfabkqI6AhNDuC/K5386ZB4UBfvf6zv7lLeNwLl3QHQ=;\r
29         b=Wr0pdzEOgntsjd37OFK678v0jINZHfT9oCSTdJb+fThNqBHFDhinyzsW9MWU8Kd7Rw\r
30         D/wnLSd2k3QltXOV0OO6YmJPbJc3b+RWmG+r8wVVFkDVijrw5YiPMP3tLlSvVH/Qoo/G\r
31         9DpnAOQPEbcsE5MNedup9+mIX5R53uaosaIhyb71sq9nKQy2WK2/mSt/MXmQ5xJ5k9ZT\r
32         ItF0K++E5KN9R8q7OKq1wa8NnyN3+qJx4Y+VVAW64lwFwOWkq84FuFXSGzC+YdI0XKBd\r
33         RKUpswEU545FR5jHU/Oylt9iUO0531xETbiHxor4wt5om9HQmh7Hu9mPX4+fB4T+6g0L\r
34         6WvA==\r
35 X-Received: by 10.180.36.147 with SMTP id q19mr4501563wij.26.1370024841834;\r
36         Fri, 31 May 2013 11:27:21 -0700 (PDT)\r
37 Received: from localhost (92.40.240.237.threembb.co.uk. [92.40.240.237])\r
38         by mx.google.com with ESMTPSA id fz8sm5734304wib.2.2013.05.31.11.27.20\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Fri, 31 May 2013 11:27:21 -0700 (PDT)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org, Austin Clements <aclements@csail.mit.edu>,\r
44         Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
45 Subject: [PATCH v3 3/5] emacs: show: pass button to create-overlays\r
46 Date: Fri, 31 May 2013 19:26:44 +0100\r
47 Message-Id: <1370024806-6616-4-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.10.4\r
49 In-Reply-To: <1370024806-6616-1-git-send-email-markwalters1009@gmail.com>\r
50 References: <1370024806-6616-1-git-send-email-markwalters1009@gmail.com>\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Fri, 31 May 2013 18:27:42 -0000\r
64 \r
65 Now that the bodypart code has the button we can pass that to\r
66 create-overlays and simplify that.\r
67 ---\r
68  emacs/notmuch-show.el |   26 ++++++++++++--------------\r
69  1 file changed, 12 insertions(+), 14 deletions(-)\r
70 \r
71 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
72 index be3aeac..66cc3a5 100644\r
73 --- a/emacs/notmuch-show.el\r
74 +++ b/emacs/notmuch-show.el\r
75 @@ -851,21 +851,19 @@ message at DEPTH in the current thread."\r
76        (setq handlers (cdr handlers))))\r
77    t)\r
78  \r
79 -(defun notmuch-show-create-part-overlays (msg beg end hide)\r
80 +(defun notmuch-show-create-part-overlays (button beg end hide)\r
81    "Add an overlay to the part between BEG and END"\r
82 -  (let* ((button (button-at beg))\r
83 -        (part-beg (and button (1+ (button-end button)))))\r
84 -\r
85 -    ;; If the part contains no text we do not make it toggleable. We\r
86 -    ;; also need to check that the button is a genuine part button not\r
87 -    ;; a notmuch-wash button.\r
88 -    (when (and button (/= part-beg end) (button-get button :base-label))\r
89 -      (button-put button 'overlay (make-overlay part-beg end))\r
90 -      ;; We toggle the button for hidden parts as that gets the\r
91 +\r
92 +  ;; If there is no button (i.e., the part is text/plain and the first\r
93 +  ;; part) or if the part has no content then we don't make the part\r
94 +  ;; toggleable.\r
95 +  (when (and button (/= beg end))\r
96 +    (button-put button 'overlay (make-overlay beg end))\r
97 +    ;; We toggle the button for hidden parts as that gets the\r
98        ;; button label right.\r
99        (save-excursion\r
100         (when hide\r
101 -         (notmuch-show-toggle-part-invisibility button))))))\r
102 +         (notmuch-show-toggle-part-invisibility button)))))\r
103  \r
104  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
105    "Insert the body part PART at depth DEPTH in the current thread.\r
106 @@ -879,10 +877,10 @@ If HIDE is non-nil then initially hide this part."\r
107                              "text/x-diff")\r
108                         content-type))\r
109          (nth (plist-get part :id))\r
110 -        (beg (point))\r
111          ;; We omit the part button for the first (or only) part if this is text/plain.\r
112          (button (unless (and (string= mime-type "text/plain") (<= nth 1))\r
113 -                  (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename)))))\r
114 +                  (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))\r
115 +        (beg (point)))\r
116  \r
117      (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)\r
118      ;; Some of the body part handlers leave point somewhere up in the\r
119 @@ -891,7 +889,7 @@ If HIDE is non-nil then initially hide this part."\r
120      ;; Ensure that the part ends with a carriage return.\r
121      (unless (bolp)\r
122        (insert "\n"))\r
123 -    (notmuch-show-create-part-overlays msg beg (point) hide)))\r
124 +    (notmuch-show-create-part-overlays button beg (point) hide)))\r
125  \r
126  (defun notmuch-show-insert-body (msg body depth)\r
127    "Insert the body BODY at depth DEPTH in the current thread."\r
128 -- \r
129 1.7.10.4\r
130 \r