Re: [PATCH 1/1] Make buttons for attachments allow viewing as well as saving
[notmuch-archives.git] / 48 / 065c76c623e6a4a1e6deacfca8ea2ac4a4b3eb
1 Return-Path: <jrollins@finestructure.net>\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 960BE431E64\r
6         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 11:31:21 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.29\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id Be0SH3bBE2fj for <notmuch@notmuchmail.org>;\r
16         Mon, 16 Jan 2012 11:31:21 -0800 (PST)\r
17 Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
18         [131.215.239.19])\r
19         by olra.theworths.org (Postfix) with ESMTP id 0AD1F431FB6\r
20         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 11:31:21 -0800 (PST)\r
21 Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
22         by earth-doxen-postvirus (Postfix) with ESMTP id B884766E016C;\r
23         Mon, 16 Jan 2012 11:31:20 -0800 (PST)\r
24 X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
25 Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com\r
26         [76.174.137.84]) (Authenticated sender: jrollins)\r
27         by earth-doxen-submit (Postfix) with ESMTP id BD40F66E00F4;\r
28         Mon, 16 Jan 2012 11:31:17 -0800 (PST)\r
29 Received: by finestructure.net (Postfix, from userid 1000)\r
30         id 56EB02C8; Mon, 16 Jan 2012 11:31:17 -0800 (PST)\r
31 From: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH 1/1] Make buttons for attachments allow viewing as well as\r
34         saving\r
35 In-Reply-To: <1326629796-11436-2-git-send-email-markwalters1009@gmail.com>\r
36 References: <1326629796-11436-1-git-send-email-markwalters1009@gmail.com>\r
37         <1326629796-11436-2-git-send-email-markwalters1009@gmail.com>\r
38 User-Agent: Notmuch/0.11+63~g6965a07 (http://notmuchmail.org) Emacs/23.3.1\r
39         (x86_64-pc-linux-gnu)\r
40 Date: Mon, 16 Jan 2012 11:31:16 -0800\r
41 Message-ID: <87wr8r5trv.fsf@servo.finestructure.net>\r
42 MIME-Version: 1.0\r
43 Content-Type: multipart/signed; boundary="=-=-=";\r
44         micalg=pgp-sha256; protocol="application/pgp-signature"\r
45 X-BeenThere: notmuch@notmuchmail.org\r
46 X-Mailman-Version: 2.1.13\r
47 Precedence: list\r
48 List-Id: "Use and development of the notmuch mail system."\r
49         <notmuch.notmuchmail.org>\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
53 List-Post: <mailto:notmuch@notmuchmail.org>\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
57 X-List-Received-Date: Mon, 16 Jan 2012 19:31:21 -0000\r
58 \r
59 --=-=-=\r
60 Content-Transfer-Encoding: quoted-printable\r
61 \r
62 On Sun, 15 Jan 2012 12:16:36 +0000, Mark Walters <markwalters1009@gmail.com=\r
63 > wrote:\r
64 > Define a keymap for attachment buttons to allow multiple actions.\r
65 > Define 3 possible actions:\r
66 >     save attachment: exactly as currently,\r
67 >     view attachment: uses mailcap entry,\r
68 >     view attachment with user chosen program\r
69 \r
70 Great improvement, Mark!  Thanks for this.  I've been wanting this kind\r
71 of functionality for a while, actually, and this is a really great\r
72 implementation.  It works like a charm, and the code looks good to me,\r
73 modulo a couple small comments below.\r
74 \r
75 > Keymap on a button is: s for save, v for view and o for view with\r
76 > other program. Default (i.e. enter or mouse button) is save but is\r
77 > easily configurable e.g. set to view with\r
78 > (setq notmuch-show-part-button-default-action 'notmuch-show-part-view-act=\r
79 ion)\r
80 \r
81 Actually, this should really be a defcustom.  Maybe something like this:\r
82 \r
83 (defcustom notmuch-show-part-button-default-action 'notmuch-show-part-butto=\r
84 n-save\r
85   "Default part header button action (on ENTER or mouse click)."\r
86   :group 'notmuch\r
87   :type '(choice (function :tag "Save part"\r
88                           :value notmuch-show-part-button-save)\r
89                 (function :tag "View part"\r
90                           :value notmuch-show-part-button-view)\r
91                 (function :tag "View interactively"\r
92                           :value notmuch-show-part-button-interactively-vie=\r
93 w))\r
94 \r
95 Unfortunately this isn't quite working right, since it's not setting the\r
96 default properly, but if someone can help me figure out what I'm doing\r
97 wrong, I think this is at least the right idea.\r
98 \r
99 > One implementation detail: the view attachment function forces all\r
100 > attachments to be "displayed" using mailcap even if emacs could\r
101 > display them itself. Thus, for example, text/html appears in a browser\r
102 > and text/plain asks whether to save (on a standard debian setup)\r
103 \r
104 I think this is good.\r
105 \r
106 > +(defvar notmuch-show-part-button-default-action 'notmuch-show-part-save-=\r
107 action)=20\r
108 \r
109 There's a white space at the end of this line, which produces the\r
110 following git warning:\r
111 \r
112   Applying: Make buttons for attachments allow viewing as well as saving\r
113   /home/jrollins/src/notmuch/git/.git/rebase-apply/patch:96: trailing white=\r
114 space.\r
115   (defvar notmuch-show-part-button-default-action 'notmuch-show-part-save-a=\r
116 ction)\r
117   warning: 1 line adds whitespace errors.\r
118 \r
119 So if you go with (an improved version of) my defcustom suggestion above\r
120 you can kill two birds with one stone:\r
121 \r
122 =2D(defvar notmuch-show-part-button-default-action 'notmuch-show-part-save-=\r
123 action)=20\r
124 +(defcustom notmuch-show-part-button-default-action '(notmuch-show-part-but=\r
125 =3D\r
126 ton-save)\r
127 +  "Default part header button action (on ENTER or mouse click)."\r
128 +  :group 'notmuch\r
129 +  :type '(choice (function :tag "Save part"\r
130 +                          :value notmuch-show-part-button-save)\r
131 +                (function :tag "View part"\r
132 +                          :value notmuch-show-part-button-view)\r
133 +                (function :tag "View interactively"\r
134 +                          :value notmuch-show-part-button-interactively-vi=\r
135 ew))\r
136 \r
137 jamie.\r
138 \r
139 --=-=-=\r
140 Content-Type: application/pgp-signature\r
141 \r
142 -----BEGIN PGP SIGNATURE-----\r
143 Version: GnuPG v1.4.11 (GNU/Linux)\r
144 \r
145 iQIcBAEBCAAGBQJPFHsEAAoJEO00zqvie6q8J88QAKtNikW4qQBmhYDyjLG79Wf6\r
146 gs1HIiuza3DtA/Q4NKEKgZjT56Rtk9fGRwAELY1oPtkKNhoLa9QQ7qfvfGsbjEBK\r
147 Iv/iOsPqsYme4vXx7pLNLkmAS4jOSK20PYGik0408h/0JxEvNkWyCU0x2hyClnGB\r
148 NMKUf/J24lX76L6OlG9xtaWPWZwkHTQexoeFy9+K6eUudPFEPaIw6dt1R0m/FgES\r
149 2U6HYUmM2zfw18EBJdOvYkjVUfgAdB2xi49k32y4RP+mqktUk2Z53ZlNSct1NOpe\r
150 /Ev+fEqX6/3RDPTqCY7wYJPVukGruwS4n0pvjF8SCDf4LTq1Hmq/Zz7dNQoxAbxq\r
151 FlZGxuMvZ03ivznNNA3tbpzt6N2fn+MLJD7czqAAZEEZYNRqIslNA2Rn1Fzuawig\r
152 l9Sgt6WpspdUCXQzRUzc8WiYkzIkS23h45bKL/JQo7JzOXk1Q26P0WOsnrOkTs/e\r
153 vOIa/zI+yJrcr94CLpBvKfMstZQe7LYQ81MwIRrPG84XzmRshaLluZuao2mBFE48\r
154 ca2YMKhFYDitV8T1iaa/RDjLfu5XFOuU6Gacg8ggDOhIeyJZkBjncd5DgoQH0aLJ\r
155 qq5wnzAaR/wo3A4DGwXShk3LaTQQ8x6PnGOp3fSFGyShxKRWGEJdPXXh/dxldDRN\r
156 46ef6yYLYYZfWvGGqcmY\r
157 =Vbd8\r
158 -----END PGP SIGNATURE-----\r
159 --=-=-=--\r