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