Re: new "crypto" branch providing full PGP/MIME support
[notmuch-archives.git] / 89 / c2ac3530b9fcf7bd51b2367af4a4bf39c6562f
1 Return-Path: <alex.boterolowry@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 DFE00431FC3\r
6         for <notmuch@notmuchmail.org>; Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id WlQzG8XU5rFM for <notmuch@notmuchmail.org>;\r
11         Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
12 Received: from mail-gx0-f225.google.com (mail-gx0-f225.google.com\r
13         [209.85.217.225])\r
14         by olra.theworths.org (Postfix) with ESMTP id 70F79431FC0\r
15         for <notmuch@notmuchmail.org>; Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
16 Received: by gxk25 with SMTP id 25so5944187gxk.0\r
17         for <notmuch@notmuchmail.org>; Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
18 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
19         h=domainkey-signature:received:received:received:from:to:cc:subject\r
20         :date:message-id:x-mailer:in-reply-to:references;\r
21         bh=qRfrCGP55+BJ1M1Sx581PzEMIxdwfn+dqhSOrNP4Ixw=;\r
22         b=ZAmfXFEoBuek50laFlZ1iR724VUc4HRuyhjDVSMZKwfUArGC9N+keyF44Z7mPIMz55\r
23         gq3k9KNP2+V33ZZojFDRSRcqczxD0pQNrGtwdzOIT0HyxSVbIkd38i9mOtBgcE0msRTd\r
24         QAOYuLxnyXlUjoRQusGpDAbJn7SJhZR84a7n4=\r
25 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
26         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
27         b=slhXuxTbkhxh1e6oZlwzed52Dl97FY09IF40TcKJKlyEyMO54hBNEuotm7ZMBjOPz4\r
28         QbH7AhGu7TE71HzCg1+zKkmFUZK2TPfcwjd6kFEow68LvrdTNncreiTnLWk0fnRd6Ko7\r
29         S6ESoMxr2T2kdHmQyyWjGnAvld4rQrxAnIMww=\r
30 Received: by 10.150.3.14 with SMTP id 14mr5802306ybc.228.1259048722072;\r
31         Mon, 23 Nov 2009 23:45:22 -0800 (PST)\r
32 Received: from fortitudo (70-36-144-85.dsl.dynamic.sonic.net [70.36.144.85])\r
33         by mx.google.com with ESMTPS id 13sm2537484gxk.13.2009.11.23.23.45.20\r
34         (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
35         Mon, 23 Nov 2009 23:45:21 -0800 (PST)\r
36 Received: from alexbl (uid 1001) (envelope-from alexbl@fortitudo) id 7059\r
37         by fortitudo (DragonFly Mail Agent) Mon, 23 Nov 2009 23:45:25 -0800\r
38 From: Alexander Botero-Lowry <alex.boterolowry@gmail.com>\r
39 To: notmuch@notmuchmail.org\r
40 Date: Mon, 23 Nov 2009 23:45:05 -0800\r
41 Message-Id: <1259048707-3062-3-git-send-email-alex.boterolowry@gmail.com>\r
42 X-Mailer: git-send-email 1.6.5.2\r
43 In-Reply-To: <1259048707-3062-2-git-send-email-alex.boterolowry@gmail.com>\r
44 References: <1259048707-3062-1-git-send-email-alex.boterolowry@gmail.com>\r
45         <1259048707-3062-2-git-send-email-alex.boterolowry@gmail.com>\r
46 Subject: [notmuch] [PATCH 3/5] make a nice function for generating\r
47         invisibility toggle buttons\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.12\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Tue, 24 Nov 2009 07:45:23 -0000\r
61 \r
62 I realized I was replicating this code over and over again, so this\r
63 way if I change my mind about something I only have to do it on one\r
64 place.\r
65 ---\r
66  notmuch.el |   45 ++++++++++++++++-----------------------------\r
67  1 files changed, 16 insertions(+), 29 deletions(-)\r
68 \r
69 diff --git a/notmuch.el b/notmuch.el\r
70 index ed1f7cb..23a07cc 100644\r
71 --- a/notmuch.el\r
72 +++ b/notmuch.el\r
73 @@ -497,6 +497,13 @@ which this thread was originally shown."\r
74    (force-window-update)\r
75    (redisplay t))\r
76  \r
77 +(defun notmuch-configure-invisibility-button (btn invis-spec help-msg)\r
78 +  (button-put btn 'invisibility-spec invis-spec)\r
79 +  (button-put btn 'action 'notmuch-toggle-invisible-action)\r
80 +  (button-put btn 'follow-link t)\r
81 +  (button-put btn 'help-echo (concat "mouse-1, RET: " help-msg))\r
82 +)\r
83 +\r
84  (defun notmuch-show-markup-citations-region (beg end depth)\r
85    (goto-char beg)\r
86    (beginning-of-line)\r
87 @@ -512,22 +519,13 @@ which this thread was originally shown."\r
88                    (invis-spec (make-symbol "notmuch-citation-region")))\r
89                (add-to-invisibility-spec invis-spec)\r
90               (overlay-put overlay 'invisible invis-spec)\r
91 -              (let (\r
92 -                    (p (point))\r
93 +              (let ((p (point))\r
94                      (cite-button-text\r
95                       (concat "["  (number-to-string (count-lines beg-sub (point)))\r
96 -                             "-line citation.]"))\r
97 -                    )\r
98 +                             "-line citation.]")))\r
99                  (goto-char (- beg-sub 1))\r
100                  (insert (concat "\n" indent))\r
101 -                (let ((cite-button (insert-button cite-button-text)))\r
102 -                  (button-put cite-button 'invisibility-spec invis-spec)\r
103 -                  (button-put cite-button 'action 'notmuch-toggle-invisible-action)\r
104 -                  (button-put cite-button 'follow-link t)\r
105 -                  (button-put cite-button 'help-echo\r
106 -                              "mouse-1, RET: Show citation")\r
107 -\r
108 -                  )\r
109 +                (notmuch-configure-invisibility-button (insert-button cite-button-text) invis-spec "Show citation")\r
110                  (insert "\n")\r
111                  (goto-char (+ (length cite-button-text) p))\r
112                ))))\r
113 @@ -543,16 +541,9 @@ which this thread was originally shown."\r
114                    \r
115                      (goto-char (- beg-sub 1))\r
116                      (insert (concat "\n" indent))\r
117 -                    (let ((sig-button (insert-button \r
118 -                                       (concat "[" (number-to-string sig-lines)\r
119 -                                         "-line signature.]"))))\r
120 -                      (button-put sig-button 'invisibility-spec invis-spec)\r
121 -                      (button-put sig-button 'action\r
122 -                                  'notmuch-toggle-invisible-action)\r
123 -                      (button-put sig-button 'follow-link t)\r
124 -                      (button-put sig-button 'help-echo\r
125 -                                  "mouse-1, RET: Show signature")\r
126 -                      )\r
127 +                    (notmuch-configure-invisibility-button\r
128 +                     (insert-button (concat "[" (number-to-string sig-lines)\r
129 +                                            "-line signature.]"))  invis-spec "Show signature")\r
130                      (insert "\n")\r
131                      (goto-char end))))))\r
132        (forward-line))))\r
133 @@ -623,13 +614,9 @@ which this thread was originally shown."\r
134                         'invisible invis-spec)\r
135            (goto-char beg)\r
136            (forward-line)\r
137 -          (let ((header-button (make-button (line-beginning-position) (line-end-position))))\r
138 -            (button-put header-button 'invisibility-spec (cons invis-spec t))\r
139 -            (button-put header-button 'action 'notmuch-toggle-invisible-action)\r
140 -            (button-put header-button 'follow-link t)\r
141 -            (button-put header-button 'help-echo\r
142 -                        "mouse-1, RET: Show headers")\r
143 -          ))\r
144 +          (notmuch-configure-invisibility-button\r
145 +           (make-button (line-beginning-position) (line-end-position))\r
146 +           (cons invis-spec t) "Show headers"))\r
147          (goto-char end)\r
148          (insert "\n")\r
149         (set-marker beg nil)\r
150 -- \r
151 1.6.5.2\r
152 \r