Re: [PATCH 1/1] Make buttons for attachments allow viewing as well as saving

Subject: Re: [PATCH 1/1] Make buttons for attachments allow viewing as well as saving

Date: Mon, 16 Jan 2012 15:11:59 -0500

To: Jameson Graef Rollins

Cc: notmuch@notmuchmail.org

From: Austin Clements


Quoth Jameson Graef Rollins on Jan 16 at 11:31 am:
> On Sun, 15 Jan 2012 12:16:36 +0000, Mark Walters <markwalters1009@gmail.com> 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-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.

Jamie's defcustom doesn't work for me either (apparently it works even
less for me than it does for Jamie), but the following works for me

(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 (const :tag "Save part"
                        notmuch-show-part-button-save)
                 (const :tag "View part"
                        notmuch-show-part-button-view)
                 (const :tag "View interactively"
                        notmuch-show-part-button-interactively-view)))

Thread: