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 44935421197 for ; Tue, 17 Jan 2012 12:26:21 -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 6OJW2kmElcET for ; Tue, 17 Jan 2012 12:26:17 -0800 (PST) Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU [18.9.25.12]) by olra.theworths.org (Postfix) with ESMTP id 364C0421192 for ; Tue, 17 Jan 2012 12:26:17 -0800 (PST) X-AuditID: 1209190c-b7fad6d000000920-a6-4f15d968fb20 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP id 78.83.02336.869D51F4; Tue, 17 Jan 2012 15:26:16 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q0HKQGWD025458; Tue, 17 Jan 2012 15:26:16 -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 q0HKQFWT015170 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 17 Jan 2012 15:26:16 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1RnFbY-00085M-0U; Tue, 17 Jan 2012 15:26:04 -0500 Date: Tue, 17 Jan 2012 15:26:03 -0500 From: Austin Clements To: Mark Walters Subject: Re: [PATCH 1/1] Make buttons for attachments allow viewing as well as saving Message-ID: <20120117202603.GP16740@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> <20120117022330.GE16740@mit.edu> <8739beitq4.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8739beitq4.fsf@qmul.ac.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAKsWRmVeSWpSXmKPExsUixCmqrJtxU9Tf4NtTfYvVc3ksrt+cyezA 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZey++JSt4IJgRcvi+6wNjG18XYycHBICJhJL en6zQ9hiEhfurWfrYuTiEBLYxyjx4/FSJghnA6PE7etzGSGck0wSE88tYYVwljBKzL/eyAbS zyKgKvHm810WEJtNQENi2/7ljCC2iICOxO1DC8B2MAtIS3z73cwEYgsLhEvcuQMR5wWquXLq DDPE0MlMEqf6t7NBJAQlTs58wgLRrCVx499LoGYOsEHL/3GAhDmBdk1efQdsl6iAisSUk9vY JjAKzULSPQtJ9yyE7gWMzKsYZVNyq3RzEzNzilOTdYuTE/PyUot0DfVyM0v0UlNKNzGCA1uS Zwfjm4NKhxgFOBiVeHglNoj6C7EmlhVX5h5ilORgUhLlnXUDKMSXlJ9SmZFYnBFfVJqTWnyI UYKDWUmE99JloBxvSmJlVWpRPkxKmoNFSZxXReudn5BAemJJanZqakFqEUxWhoNDSYL3MshQ waLU9NSKtMycEoQ0EwcnyHAeoOEnQWp4iwsSc4sz0yHypxh1OU6uvXKOUYglLz8vVUqcdxlI kQBIUUZpHtwcWEJ6xSgO9JYw7ymQKh5gMoOb9ApoCRPQkpxWIZAlJYkIKakGxqYHS4yl1XxM Dqxf++1W8gHzGyy7FDe6fVvCOq9W8QX/TLXIgAzZk6sWO8hqnJn8VE9OzDpeWdj+7e787XPj /s6rdo3/GnCFoV2t4Z3QGsbs/XvF/30tbmyVb/ZLreVUc7kk0SY6Z1rnL/UH+9iWzrjyyuak 4lkzxVf75lSuWKIdnZgpZlIjq8RSnJFoqMVcVJwIACdMdXAjAwAA 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 20:26:21 -0000 Quoth Mark Walters on Jan 17 at 9:06 am: > > > > 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. > > I am happy to make that change. My original patch in the summer was more > like that: > id:"CALUdzSWAto+4mCUOOMk+8vFs+Pog-xUma6u-Aqx2M6-sbyQROg@mail.gmail.com" Is this the right id? I couldn't find it in the list archive. > Is that more what you had in mind? (Only in broad terms: Obviously I > would need to add in the customization and default function etc). I > decided that I didn't like the code duplication (but I am completely new > to lisp) which is why I changed it for this submission. Yes, I wondered about this, too. It seems like at worst the notmuch-show-process-crypto stuff would be duplicated. This might be little enough that it's not worth worrying about, or it might be worth introducing something like (defun notmuch-with-temp-part-buffer (message-id nth action) (let ((process-crypto notmuch-show-process-crypto)) (with-temp-buffer (setq notmuch-show-process-crypto process-crypto) ;; Always acquires the part via `notmuch part', even if it is ;; available in the JSON output. (insert (notmuch-show-get-bodypart-internal message-id nth)) (funcall action)))) You could also do this as a macro, but that definitely seems like overkill.