Q: How do I view PPT attachments in mutt in the background?

Gmail is enticing because of its search and easy handling of attachments and images, but there’s a lot of inertia for me to overcome. I’m a command-line mail person from way back, and I use my inbox as my to-do list. Currently, I have 8,413 8,462 things to do. Seriously. No, really. Now you understand why it takes me a while to write back to my emails, and why it takes me a while to approve comments here. :)

So I’m still using mutt for now, and I have to say that it’s pretty nice 95% of the time. There were two things that annoyed me though:

  1. When you spawn an external viewer for a file, mutt pauses until you close the viewer program to resume
  2. My default set of viewers didn’t have bindings for PowerPoint (this is for my Linux machine)

In trying to fix #2, I found out how to fix #1. Some searching and digging on mutt.org uncovered this delightful page. It turns out that mutt is single-threaded, which is why it hangs to invoke an external viewer. But after the viewer closes, mutt cleans up the temporary document, so you can’t just run the viewer in the background. The solution is to write a script that copies the temp doc to a different location. Gary Johnson wrote that script (mutt_bgrun); here’s a local copy that you can save and make executable.

Now let’s fix #2. I’m not a MIME-maniac, but lets assume that you have OpenOffice (the ooffice executable) on your system. Add the following to the bottom of your ~/.mailcap file:
# view in OOffice viewer for PowerPoint
application/vnd.ms-powerpoint;mutt_bgrun ooffice %s; test=sh -c 'test $DISPLAY'
application/x-mspowerpoint; mutt_bgrun ooffice %s; test=sh -c 'test $DISPLAY'
application/ppt; mutt_bgrun ooffice %s; test=sh -c 'test $DISPLAY'

The fields are delimited with semicolons. The first field is the MIME type. The second field is how to invoke a viewer (note the use of mutt_bgrun so that we run the ooffice viewer in a different process in the background). The last field is a test to determine if you’re running X. If you aren’t running X, you might be able to install some sort of ppt2text viewer and then add .mailcap entries like application/ppt; ppt2text %s; copiousoutput to view in text. The copiousoutput means that ppt2text might output a lot of data to stdout, and hints that a pager like “less” might be handy.

Once you make the change to your ~/.mailcap file, you can immediately try to view a .ppt attachment in mutt to see if it works.

P.S. Some mail programs won’t label data as “application/vnd.ms-powerpoint” or similar; instead, they use the generic label “application/octet-stream”, which means “this is a binary blob–good luck!” Once again, http://www.spocom.com/users/gjohnson/mutt/ is your friend, this time with a file http://www.spocom.com/users/gjohnson/mutt/mutt_octet_view as a generic external viewer, plus an entry like this in your ~/.mailcap file:
# Try to handle octet-stream
application/octet-stream; mutt_octet_view -x %s; test=sh -c 'test $DISPLAY'
application/octet-stream; mutt_octet_view -v %s
application/octet-stream; mutt_octet_view %s; copiousoutput

Although I have to say, the autosave of drafts in Gmail is nice, and has already saved my bacon once. What UI person decided that the backspace key should be like clicking the back button?? You’re typing a long email, you click outside the textarea without realizing it and lose the cursor focus, then you hit the backspace button and you lose your entire email. Grr. If Gmail hadn’t autosaved, I would have been pretty angry. And as long as I’m ranting about web annoyances: you owe it to yourself to check out the Resizeable Textarea extension. You just click on the bottom/right border of the textarea and drag–nice for those ginormous emails. Resizeable Textarea is my favorite extension since ListZilla, with the simplest, most intuitive UI for me since miniT.

Will I ever switch over to a web-based email system? Well first, I just have to knock out 8,462 more emails to various folks so I have a clean slate. Sigh. What do you use to make email more manageable?

17 Responses to Q: How do I view PPT attachments in mutt in the background? (Leave a comment)

  1. John

    I haven’t tried the Resizeable Textarea extension, but External Editor ( http://nullref.se/projects/externaleditor ) is great. You can now access the contents of a textarea through vim or any other text editor, so you can search and replace, cut and paste, etc in your favourite editor rather than using the rather basic capabilities of a text box.

  2. I like Opera.

    Email is integrated with your browsing experience into one app, as are feeds. Other nice time-saving features can help you get to those backed up emails. It sure is easy for them to pile up high. It never goes away. The thing that bugs me about it is, when I start to make a difference and (use a holiday?) to read backed up messages, I often find that too much time has passed and answering becomes difficult, (or the issue disappeared in the meantime).

    sheesh

    Best,
    -detlev

  3. Naw

    The mutt is cool, but… I’m using for while the sylpheed! Works fine, very lightweight and useful.

  4. Hey, didnt notice you were a mutt fan matt. I recently switched to mutt-ng, as it has cached headers for one thing – but they’re pretty similar as you’d imagine.

    One thing i’ve not mangaged to find out how to do (but had it going on an old machine, sadly departed) is to get links to appear in a firefox tab?

    I just can’t remember where the command is put for that – it dont see anything in ~/.mutt.rc nor in ~/.mailcap

    you know where that’s located? and if so, could you post the line you have that does that?

    Cheers!

  5. Matt, OMG you are still on mutt? :-)
    Well, you asked: I decided to go IMAP with a mail service provider, where I got around 2 Gig of storage for a yearly fee and I have a web interface, too. I got my pine configged to use it (http://nic.phys.ethz.ch/readme/19) and the Outlook at my parents place and my iBook, if I travel. For me, IMAP is the final email solution and I can use whatever client I like on whatever platform!
    Btw: other people want GMail to be an IMAP client, too: http://laughingmeme.org/archives/002531.html

  6. ” What UI person decided that the backspace key should be like clicking the back button??”

    Sounds like they’re just imitating expected browser behaviour. Almost every browser uses the backspace key as a shortcut for the back-button (try it), I don’t see why an AJAX application such as gmail should be any different.

  7. I recently switched to gmail from Eudora, but miss having offline access to my mail. Seems gmail could add that feature.

    I like gmail’s simple, non folder approaches to archiving and searching.

  8. Kris

    Off-topic for this particular post; but a quick question: G doesn’t highlight Capitalized keywords in URL’s (only lowercase). Is this a post-query highlighting filter bug (that’s been around for 1 year and not fixed) or is this indicative of capitalized keywords in the URL not “counting”?

  9. Steve

    > 8000 emails to answer? Sounds like you need an assistant, or an extra large heavy duty delete key and a wireless/chipless vacation :)

  10. You should check out POPFile. It uses Bayesian filtering to classify mail into any number of catagories you setup. That could help make that much email easier to deal with. It is also good at spam filtering.

    http://getpopfile.org

  11. I just can’t remember where the command is put for that – it dont see anything in ~/.mutt.rc nor in ~/.mailcap

    you know where that’s located? and if so, could you post the line you have that does that?

  12. 8000 emails? You are the man! How do you classify each one of them?

  13. bamhi

    iam on mutt

    there is NOTHING else

  14. bamhi

    i get thousands of emails NON-list /month

  15. Here’s a quick Python script to add mutt_bgrun to all (X windows) entries from /etc/mailcap and write them to your ~/.mailcap file.


    import os

    mymailcap = open(os.path.expanduser('~/.mailcap'), 'wb')
    for line in open('/etc/mailcap'):
    parts = line.split(';')
    if 'DISPLAY' in line:
    parts[1] = ' mutt_bgrun ' + parts[1]
    mymailcap.write(';'.join(parts))
    mymailcap.close()

Leave a Comment

Your email address will not be published. Required fields are marked *

*

If you have a question about your site specifically or a general question about search, your best bet is to post in our Webmaster Help Forum linked from http://google.com/webmasters

If you comment, please use your personal name, not your business name. Business names can sound salesy or spammy, and I would like to try people leaving their actual name instead.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

css.php