Re: [PATCH 1/1] Make buttons for attachments allow viewing as well as saving
authorAustin Clements <amdragon@MIT.EDU>
Tue, 17 Jan 2012 02:23:30 +0000 (21:23 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:42:22 +0000 (09:42 -0800)
20/ac75fafdd827d13c26ed6689bf452de6cd7f54 [new file with mode: 0644]

diff --git a/20/ac75fafdd827d13c26ed6689bf452de6cd7f54 b/20/ac75fafdd827d13c26ed6689bf452de6cd7f54
new file mode 100644 (file)
index 0000000..334abf0
--- /dev/null
@@ -0,0 +1,134 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 09123429E3B\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 18:23:44 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id FfxKH8ofMlEj for <notmuch@notmuchmail.org>;\r
+       Mon, 16 Jan 2012 18:23:43 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
+       [18.7.68.35])\r
+       by olra.theworths.org (Postfix) with ESMTP id 236F3429E35\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 18:23:43 -0800 (PST)\r
+X-AuditID: 12074423-b7f9c6d0000008c3-56-4f14dbae0278\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 53.54.02243.EABD41F4; Mon, 16 Jan 2012 21:23:42 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q0H2Nf9N030603; \r
+       Mon, 16 Jan 2012 21:23:42 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0H2NdWX005024\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 16 Jan 2012 21:23:40 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1Rmyhu-0006N2-Fq; Mon, 16 Jan 2012 21:23:30 -0500\r
+Date: Mon, 16 Jan 2012 21:23:30 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH 1/1] Make buttons for attachments allow viewing as well\r
+       as saving\r
+Message-ID: <20120117022330.GE16740@mit.edu>\r
+References: <1326629796-11436-1-git-send-email-markwalters1009@gmail.com>\r
+       <1326629796-11436-2-git-send-email-markwalters1009@gmail.com>\r
+       <87wr8r5trv.fsf@servo.finestructure.net>\r
+       <87lip7fhkc.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87lip7fhkc.fsf@qmul.ac.uk>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42IRYrdT0V13W8TfYP1uZYvVc3ksrt+cyezA\r
+       5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZRy/zFFwR7TiyORbzA2MhwS6GDk5JARMJK50\r
+       7GeHsMUkLtxbz9bFyMUhJLCPUeLUy9UsEM4GRonD0/sYIZyTTBIv+z5DZZYwSrz8dIkZpJ9F\r
+       QFWie+cORhCbTUBDYtv+5WC2iICOxO1DC8B2MAtIS3z73cwEYgsLhEvcuQMR5wWq+b3vACvE\r
+       0EuMEkdObGGBSAhKnJz5hAWiWUvixr+XQM0cYIOW/+MACXMC7drevhhsjqiAisSUk9vYJjAK\r
+       zULSPQtJ9yyE7gWMzKsYZVNyq3RzEzNzilOTdYuTE/PyUot0zfRyM0v0UlNKNzGCw9pFeQfj\r
+       n4NKhxgFOBiVeHhveov4C7EmlhVX5h5ilORgUhLl7bgJFOJLyk+pzEgszogvKs1JLT7EKMHB\r
+       rCTCK+gDlONNSaysSi3Kh0lJc7AoifNqaL3zExJITyxJzU5NLUgtgsnKcHAoSfBKAONXSLAo\r
+       NT21Ii0zpwQhzcTBCTKcB2j4m1sgw4sLEnOLM9Mh8qcYdTlOrr1yjlGIJS8/L1VKnPcXSJEA\r
+       SFFGaR7cHFg6esUoDvSWMO97kCoeYCqDm/QKaAkT0JKcViGQJSWJCCmpBsak0AZfYcnorO2s\r
+       PXHLoo+sXOSWzix5WLbvbP87Adfmb6Z+J2NPpl7e3ZYkVrxOv2FFdCC7vsXh8GNmzKeez53/\r
+       9+iOYBv7jUmMwe/Wrr/Mo8j/sbT08eWNd1f/m3D6RJgU74fJDltm3/a6elIgUuFQOJ/fNscN\r
+       E4xKl4vOSI9+V3/llafy8l4lluKMREMt5qLiRACd7h3MIgMAAA==\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 17 Jan 2012 02:23:44 -0000\r
+\r
+Quoth Mark Walters on Jan 16 at  9:44 pm:\r
+> On Mon, 16 Jan 2012 11:31:16 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
+> > > Keymap on a button is: s for save, v for view and o for view with\r
+> > > other program. Default (i.e. enter or mouse button) is save but is\r
+> > > easily configurable e.g. set to view with\r
+> > > (setq notmuch-show-part-button-default-action 'notmuch-show-part-view-action)\r
+> > \r
+> > Actually, this should really be a defcustom.  Maybe something like this:\r
+> > \r
+> > (defcustom notmuch-show-part-button-default-action 'notmuch-show-part-button-save\r
+> >   "Default part header button action (on ENTER or mouse click)."\r
+> >   :group 'notmuch\r
+> >   :type '(choice (function :tag "Save part"\r
+> >                           :value notmuch-show-part-button-save)\r
+> >                 (function :tag "View part"\r
+> >                           :value notmuch-show-part-button-view)\r
+> >                 (function :tag "View interactively"\r
+> >                           :value notmuch-show-part-button-interactively-view))\r
+> > \r
+> > Unfortunately this isn't quite working right, since it's not setting the\r
+> > default properly, but if someone can help me figure out what I'm doing\r
+> > wrong, I think this is at least the right idea.\r
+> \r
+> This did not work for me, nor did Austin's suggestion but the following\r
+> does\r
+> +(defcustom notmuch-show-part-button-default-action 'notmuch-show-part-save-action\r
+> +  "Default part header button action (on ENTER or mouse click)."\r
+> +  :group 'notmuch\r
+> +  :type '(choice (const :tag "Save part"\r
+> +                       notmuch-show-part-save-action)\r
+> +                (const :tag "View part"\r
+> +                       notmuch-show-part-view-action)\r
+> +                (const :tag "View interactively"\r
+> +                       notmuch-show-part-interactively-view-action)))\r
+> \r
+> I wonder if the "problem" comes from me doing things in a non-lispy\r
+> fashion (I am completely new to lisp). Thus\r
+> notmuch-show-part-button-default-action is a variable that gets passed\r
+> around rather than a function.\r
+\r
+Sorry, I should have looked at the bigger context in this patch.  I\r
+think Jameson was implying that notmuch-show-part-button-default\r
+should change to\r
+\r
+(defun notmuch-show-part-button-default (&optional button)\r
+  (interactive)\r
+  (funcall notmuch-show-part-button-default-action button))\r
+\r
+I would go one step further and say that each action should probably\r
+be a separate function.  That is, break notmuch-show-part-action into\r
+separate functions and simply invoke the appropriate function, rather\r
+than performing a fixed data dispatch.  This would be more flexible\r
+and Lispy.  It may be that your approach works out better, but I'd at\r
+least give this a shot.\r