Re: [PATCH 1/1] Make buttons for attachments allow viewing as well as saving
[notmuch-archives.git] / 20 / ac75fafdd827d13c26ed6689bf452de6cd7f54
1 Return-Path: <amdragon@mit.edu>\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 09123429E3B\r
6         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 18:23:44 -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: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 FfxKH8ofMlEj for <notmuch@notmuchmail.org>;\r
16         Mon, 16 Jan 2012 18:23:43 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
18         [18.7.68.35])\r
19         by olra.theworths.org (Postfix) with ESMTP id 236F3429E35\r
20         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 18:23:43 -0800 (PST)\r
21 X-AuditID: 12074423-b7f9c6d0000008c3-56-4f14dbae0278\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 53.54.02243.EABD41F4; Mon, 16 Jan 2012 21:23:42 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q0H2Nf9N030603; \r
27         Mon, 16 Jan 2012 21:23:42 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0H2NdWX005024\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 16 Jan 2012 21:23:40 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1Rmyhu-0006N2-Fq; Mon, 16 Jan 2012 21:23:30 -0500\r
37 Date: Mon, 16 Jan 2012 21:23:30 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: [PATCH 1/1] Make buttons for attachments allow viewing as well\r
41         as saving\r
42 Message-ID: <20120117022330.GE16740@mit.edu>\r
43 References: <1326629796-11436-1-git-send-email-markwalters1009@gmail.com>\r
44         <1326629796-11436-2-git-send-email-markwalters1009@gmail.com>\r
45         <87wr8r5trv.fsf@servo.finestructure.net>\r
46         <87lip7fhkc.fsf@qmul.ac.uk>\r
47 MIME-Version: 1.0\r
48 Content-Type: text/plain; charset=us-ascii\r
49 Content-Disposition: inline\r
50 In-Reply-To: <87lip7fhkc.fsf@qmul.ac.uk>\r
51 User-Agent: Mutt/1.5.21 (2010-09-15)\r
52 X-Brightmail-Tracker:\r
53  H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42IRYrdT0V13W8TfYP1uZYvVc3ksrt+cyezA\r
54         5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZRy/zFFwR7TiyORbzA2MhwS6GDk5JARMJK50\r
55         7GeHsMUkLtxbz9bFyMUhJLCPUeLUy9UsEM4GRonD0/sYIZyTTBIv+z5DZZYwSrz8dIkZpJ9F\r
56         QFWie+cORhCbTUBDYtv+5WC2iICOxO1DC8B2MAtIS3z73cwEYgsLhEvcuQMR5wWq+b3vACvE\r
57         0EuMEkdObGGBSAhKnJz5hAWiWUvixr+XQM0cYIOW/+MACXMC7drevhhsjqiAisSUk9vYJjAK\r
58         zULSPQtJ9yyE7gWMzKsYZVNyq3RzEzNzilOTdYuTE/PyUot0zfRyM0v0UlNKNzGCw9pFeQfj\r
59         n4NKhxgFOBiVeHhveov4C7EmlhVX5h5ilORgUhLl7bgJFOJLyk+pzEgszogvKs1JLT7EKMHB\r
60         rCTCK+gDlONNSaysSi3Kh0lJc7AoifNqaL3zExJITyxJzU5NLUgtgsnKcHAoSfBKAONXSLAo\r
61         NT21Ii0zpwQhzcTBCTKcB2j4m1sgw4sLEnOLM9Mh8qcYdTlOrr1yjlGIJS8/L1VKnPcXSJEA\r
62         SFFGaR7cHFg6esUoDvSWMO97kCoeYCqDm/QKaAkT0JKcViGQJSWJCCmpBsak0AZfYcnorO2s\r
63         PXHLoo+sXOSWzix5WLbvbP87Adfmb6Z+J2NPpl7e3ZYkVrxOv2FFdCC7vsXh8GNmzKeez53/\r
64         9+iOYBv7jUmMwe/Wrr/Mo8j/sbT08eWNd1f/m3D6RJgU74fJDltm3/a6elIgUuFQOJ/fNscN\r
65         E4xKl4vOSI9+V3/llafy8l4lluKMREMt5qLiRACd7h3MIgMAAA==\r
66 Cc: notmuch@notmuchmail.org\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Tue, 17 Jan 2012 02:23:44 -0000\r
80 \r
81 Quoth Mark Walters on Jan 16 at  9:44 pm:\r
82 > On Mon, 16 Jan 2012 11:31:16 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
83 > > > Keymap on a button is: s for save, v for view and o for view with\r
84 > > > other program. Default (i.e. enter or mouse button) is save but is\r
85 > > > easily configurable e.g. set to view with\r
86 > > > (setq notmuch-show-part-button-default-action 'notmuch-show-part-view-action)\r
87 > > \r
88 > > Actually, this should really be a defcustom.  Maybe something like this:\r
89 > > \r
90 > > (defcustom notmuch-show-part-button-default-action 'notmuch-show-part-button-save\r
91 > >   "Default part header button action (on ENTER or mouse click)."\r
92 > >   :group 'notmuch\r
93 > >   :type '(choice (function :tag "Save part"\r
94 > >                           :value notmuch-show-part-button-save)\r
95 > >                 (function :tag "View part"\r
96 > >                           :value notmuch-show-part-button-view)\r
97 > >                 (function :tag "View interactively"\r
98 > >                           :value notmuch-show-part-button-interactively-view))\r
99 > > \r
100 > > Unfortunately this isn't quite working right, since it's not setting the\r
101 > > default properly, but if someone can help me figure out what I'm doing\r
102 > > wrong, I think this is at least the right idea.\r
103\r
104 > This did not work for me, nor did Austin's suggestion but the following\r
105 > does\r
106 > +(defcustom notmuch-show-part-button-default-action 'notmuch-show-part-save-action\r
107 > +  "Default part header button action (on ENTER or mouse click)."\r
108 > +  :group 'notmuch\r
109 > +  :type '(choice (const :tag "Save part"\r
110 > +                       notmuch-show-part-save-action)\r
111 > +                (const :tag "View part"\r
112 > +                       notmuch-show-part-view-action)\r
113 > +                (const :tag "View interactively"\r
114 > +                       notmuch-show-part-interactively-view-action)))\r
115\r
116 > I wonder if the "problem" comes from me doing things in a non-lispy\r
117 > fashion (I am completely new to lisp). Thus\r
118 > notmuch-show-part-button-default-action is a variable that gets passed\r
119 > around rather than a function.\r
120 \r
121 Sorry, I should have looked at the bigger context in this patch.  I\r
122 think Jameson was implying that notmuch-show-part-button-default\r
123 should change to\r
124 \r
125 (defun notmuch-show-part-button-default (&optional button)\r
126   (interactive)\r
127   (funcall notmuch-show-part-button-default-action button))\r
128 \r
129 I would go one step further and say that each action should probably\r
130 be a separate function.  That is, break notmuch-show-part-action into\r
131 separate functions and simply invoke the appropriate function, rather\r
132 than performing a fixed data dispatch.  This would be more flexible\r
133 and Lispy.  It may be that your approach works out better, but I'd at\r
134 least give this a shot.\r