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 960BE431E64 for ; Mon, 16 Jan 2012 11:31:21 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.29 X-Spam-Level: X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] 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 Be0SH3bBE2fj for ; Mon, 16 Jan 2012 11:31:21 -0800 (PST) Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu [131.215.239.19]) by olra.theworths.org (Postfix) with ESMTP id 0AD1F431FB6 for ; Mon, 16 Jan 2012 11:31:21 -0800 (PST) Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1]) by earth-doxen-postvirus (Postfix) with ESMTP id B884766E016C; Mon, 16 Jan 2012 11:31:20 -0800 (PST) X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new Received: from finestructure.net (cpe-76-174-137-84.socal.res.rr.com [76.174.137.84]) (Authenticated sender: jrollins) by earth-doxen-submit (Postfix) with ESMTP id BD40F66E00F4; Mon, 16 Jan 2012 11:31:17 -0800 (PST) Received: by finestructure.net (Postfix, from userid 1000) id 56EB02C8; Mon, 16 Jan 2012 11:31:17 -0800 (PST) From: Jameson Graef Rollins To: Mark Walters , notmuch@notmuchmail.org Subject: Re: [PATCH 1/1] Make buttons for attachments allow viewing as well as saving In-Reply-To: <1326629796-11436-2-git-send-email-markwalters1009@gmail.com> References: <1326629796-11436-1-git-send-email-markwalters1009@gmail.com> <1326629796-11436-2-git-send-email-markwalters1009@gmail.com> User-Agent: Notmuch/0.11+63~g6965a07 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Mon, 16 Jan 2012 11:31:16 -0800 Message-ID: <87wr8r5trv.fsf@servo.finestructure.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" 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: Mon, 16 Jan 2012 19:31:21 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable On Sun, 15 Jan 2012 12:16:36 +0000, Mark Walters wrote: > Define a keymap for attachment buttons to allow multiple actions. > Define 3 possible actions: > save attachment: exactly as currently, > view attachment: uses mailcap entry, > view attachment with user chosen program Great improvement, Mark! Thanks for this. I've been wanting this kind of functionality for a while, actually, and this is a really great implementation. It works like a charm, and the code looks good to me, modulo a couple small comments below. > 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-act= ion) Actually, this should really be a defcustom. Maybe something like this: (defcustom notmuch-show-part-button-default-action 'notmuch-show-part-butto= n-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-vie= w)) 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. > One implementation detail: the view attachment function forces all > attachments to be "displayed" using mailcap even if emacs could > display them itself. Thus, for example, text/html appears in a browser > and text/plain asks whether to save (on a standard debian setup) I think this is good. > +(defvar notmuch-show-part-button-default-action 'notmuch-show-part-save-= action)=20 There's a white space at the end of this line, which produces the following git warning: Applying: Make buttons for attachments allow viewing as well as saving /home/jrollins/src/notmuch/git/.git/rebase-apply/patch:96: trailing white= space. (defvar notmuch-show-part-button-default-action 'notmuch-show-part-save-a= ction) warning: 1 line adds whitespace errors. So if you go with (an improved version of) my defcustom suggestion above you can kill two birds with one stone: =2D(defvar notmuch-show-part-button-default-action 'notmuch-show-part-save-= action)=20 +(defcustom notmuch-show-part-button-default-action '(notmuch-show-part-but= =3D ton-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-vi= ew)) jamie. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBCAAGBQJPFHsEAAoJEO00zqvie6q8J88QAKtNikW4qQBmhYDyjLG79Wf6 gs1HIiuza3DtA/Q4NKEKgZjT56Rtk9fGRwAELY1oPtkKNhoLa9QQ7qfvfGsbjEBK Iv/iOsPqsYme4vXx7pLNLkmAS4jOSK20PYGik0408h/0JxEvNkWyCU0x2hyClnGB NMKUf/J24lX76L6OlG9xtaWPWZwkHTQexoeFy9+K6eUudPFEPaIw6dt1R0m/FgES 2U6HYUmM2zfw18EBJdOvYkjVUfgAdB2xi49k32y4RP+mqktUk2Z53ZlNSct1NOpe /Ev+fEqX6/3RDPTqCY7wYJPVukGruwS4n0pvjF8SCDf4LTq1Hmq/Zz7dNQoxAbxq FlZGxuMvZ03ivznNNA3tbpzt6N2fn+MLJD7czqAAZEEZYNRqIslNA2Rn1Fzuawig l9Sgt6WpspdUCXQzRUzc8WiYkzIkS23h45bKL/JQo7JzOXk1Q26P0WOsnrOkTs/e vOIa/zI+yJrcr94CLpBvKfMstZQe7LYQ81MwIRrPG84XzmRshaLluZuao2mBFE48 ca2YMKhFYDitV8T1iaa/RDjLfu5XFOuU6Gacg8ggDOhIeyJZkBjncd5DgoQH0aLJ qq5wnzAaR/wo3A4DGwXShk3LaTQQ8x6PnGOp3fSFGyShxKRWGEJdPXXh/dxldDRN 46ef6yYLYYZfWvGGqcmY =Vbd8 -----END PGP SIGNATURE----- --=-=-=--