How to search for email content in Pine

The mouse has its uses: surfing the web, editing images in GIMP, and doing layout in OmniGraffle are all far more convenient with point-and-click interactivity. But when I’m working with text, I have a definite keyboard-bias. I want to be able to keep my hands on the home row so that I can alternate between entering text and “meta” activities (file opening, file saving, moving text around, searching, copying, pasting, etc.) without having to move a hand to the mouse. This bias may also go back to my early college days, when Internet access came by dialing in over a modem, with a terminal connection (no SLIP yet!), so I learned to edit files using emacs (sans menus) and to send or receive email using Pine. Today, I find that working in graphical apps that were designed to take the place of these text-based options slows me down significantly. I can’t get around in Word without shifting over to the mouse or the arrow keys; I can’t save emails to folders without clicking and dragging.

The email problem has been particularly thorny. I use Pine when I want to file messages away from my inbox and into folders. I would just use Pine all the time, except that I really need to be able to search for messages with certain content, and I didn’t know how to do this with Pine. The w key lets you search through the current message, or the current folder listing, but it doesn’t search across a whole folder’s contents.

But yesterday that all changed. I learned how to search with Pine! And here it is:

Hit ; (select) then t (text) then a (all text), and then your search phrase. All matching messages are marked with an “X” and, since they are selected, can be “zoomed” by hitting z. This restricts the display to the selected subset of (matching) messages. Hitting z again zooms back out to the full folder.

I love this. It’s so amazingly fast! It feels like flying! I can zero in on the messages I want with ease and speed. And there are options: instead of [a]ll text, you can restrict the search to the To/From/CC/Subject/etc. fields. You can even go up to your list of folders and search across all of them, or [z]oom in on a subset and search those, etc. I’d used the select facility in Pine before, but only for selecting groups of messages for mass filing or deleting (also very handy), which meant selecting by Number or Date. I’m thrilled to have learned how to select by Text (content).

Update: I forgot to mention that for the ; key to work, you have to go into your Pine preferences (from the main menu, [s]etup, [c]onfig), page down to “Advanced Command Preferences” (or [w]hereis ‘aggregate’, to let Pine find it for you), and check the box next to “enable-aggregate-command-set”).

7 of 8 people learned something from this entry.

  1. Heuristics Inc. said,

    February 22, 2007 at 6:30 am

    (Learned something new!)

    I use Pine for all my mail-reading on my main home account. The biggest problem is when people send pictures and such I can’t open them and have to forward them to another account.
    Anyway I have often wanted something like this, but alas the ; key does nothing when i hit it (Actually it says “Command ; not defined for this screen”). You must have a newer version than me or something! Drat!
    When I need to do this I exit Pine and use “grep” on the folder… heh oldschool.

  2. wkiri said,

    February 22, 2007 at 8:27 am

    Yes, that’s what I’d been doing: grepping from the command line. I forgot to note that you have to “enable aggregate command” in the preferences for the ; to work. Thanks for reminding me!

  3. Heuristics Inc. said,

    February 22, 2007 at 9:00 am

    (Learned something new!)

    Rockin! Now that is cool. You are my new hero… er, you already were my hero but now you’re more my hero, or something like that.

  4. stough said,

    February 23, 2007 at 9:17 am

    (Learned something new!)

    Yeah, I learned something new and it’s about as useful as speaking fluent Samarian. *sigh*

    I had all these features when I was using VM (View Mail) in Emacs. ;-) Come into the next century… Keep your recent stuff in IMAP and move the old stuff down to local folders on your laptop. You almost never need the oldest stuff and you’ll have it when you have your laptop. Don’t forget regular backups stored in multiple physical locations. And has no problem searching old messages. You can import your old email into since Pine uses mbox formated folders. The backups are important in any case since our work servers aren’t really impervious to data loss.

    But, then again, you’re a romantic and historian of sorts. I’ll hang pictures from picture rail and use authentic linoleum flooring (same formula as in 1890), you stick with Pine.


  5. wkiri said,

    February 23, 2007 at 9:46 am

    The issue isn’t where to store the mail. I can do exactly what you suggest (recent stuff IMAP’d, older stored locally) and still use Pine. In fact, discovering this search facility inside Pine is what will permit me to make that move — since I will no longer need the shell and grep/less to be able to find things. :)

    The issue with is that I can’t navigate it without using the mouse. If it comes up with a reasonable way to do that, then I’ll switch to it entirely. :)

  6. Heuristics Inc. said,

    February 23, 2007 at 3:50 pm

    (Learned something new!)

    I was inspired by this new discovery to attack another Pine problem, that is, “how do I mark a message as unread when I’ve already opened it?” Similarly to this problem, it’s another config option: “enable-flag-cmd”. Then you flag a message with “*” and then “N” for “New”.

  7. wkiri said,

    February 23, 2007 at 9:22 pm

    (Knew it already.)

    Thanks for sharing this one — it makes for a great “obscure Pine tips” page. :)

  8. geoff said,

    February 24, 2007 at 9:51 am

    mutt handles attachments rather well for a text based mail reader. As much as I clung to mutt over the years, I’ve recently let it go in favor of Gmail. Gmail is keyboard friendly, / to search, j/k to move up down, x to mark something, y to archive something, r to reply, s to star something, etc., as long as you can handle a few vaguely vi-ish keys. (Come to the light side, people. ;) And of course it does indexed search, a bunch of storage, attachments, and all the other goodies related to web-based mail.

  9. wkiri said,

    February 24, 2007 at 10:30 am

    Pine handles attachments pretty well these days, to, so that’s less of an issue than it used to be. It’ll even spawn lynx for you to follow URLs if you really don’t have a windowing system going on, although lynx is definitely my least-favorite method of browsing the web. :)

    I tried out gmail, and I like the keyboard shortcuts — but there are three obstacles to my full adoption of it:

    • You can’t delete anything. I like the feeling of deleting and purging and getting rid of old stuff. I’m enough of a packrat as it is.
    • You have to use a web browser to access it. No matter how slick, it’s still slower than a terminal display. In my (outdated, no doubt) email metaphor, email is fundamentally text. I just want to read the text. I don’t want HTML email, I don’t want embedded images, and I definitely don’t want embedded mpegs or other stuff to start doing their embedded things. So all I really need is text.
    • It makes me vaguely uneasy to store my email with google. Storing my email with my employer or university seems okay, but letting a third party have it bothers me at some level.

    Maybe someday they’ll come up with the ultimate mail reader that satisfies my *every* desire! :) In the meantime, I think it’s good that there’s such a diversity available, so that people can use what suits them best.

  10. geoff said,

    February 24, 2007 at 10:48 am

    I don’t know when you tried it, but you can delete stuff now.

    I agree, email is basically text, and I can’t stand it when people attach things to email that are fundamentally text (like word docs with no meaningful formatting). But enough people were sending me attachments that I needed a faster way to open them. I found myself bouncing email from mutt to gmail just so I could get the attachments.

    As for using a web browser, you can set up gmail to pop email to the client of your choice. I live in a web browser, so I haven’t needed to do that, but I can see how that would be useful.

    Your third point is definitely valid. “Don’t be evil” just doesn’t cut it. It all depends on the level of paranoia you have. I know people who insist on running their own mail servers. I would too, but I don’t really have the time for that. So I just prefer not to use email for anything “too important”.

    Have you tried mutt? I tried pine back in college, switched to elm, then switched to mutt.

  11. wkiri said,

    February 24, 2007 at 11:07 am

    It definitely was a while ago that I tried gmail. The philosophy was that you shouldn’t *need* to delete anything, since google searching could retrieve what you wanted amongst the dreck.

    I do end up bouncing mail with attachments from Pine to on the Mac, but that’s because I log into my account via ssh and run Pine there, mainly because I’ve been storing my mail folders “locally” there. I should switch to storing old mail on my Mac (which also has Pine) and IMAPing the rest (as Tim noted above) and that would probably eliminate the need for bouncing anything. It’s funny how we can get into these habits that aren’t efficient at all, but they’re ingrained so we don’t question or fix them until forced to re-think what we’re doing. This discussion has been helpful for me. :)

  12. Neal said,

    October 14, 2012 at 8:45 am

    (Learned something new!)

    Great tip. Thank you very much.

  13. Peter Y. said,

    April 24, 2013 at 1:45 pm

    (Learned something new!)

    Just what I was looking for. Thanks!

  14. asdf said,

    August 28, 2015 at 2:52 am

    (Learned something new!)

    helpful! thanks!

Post a Comment

I knew this already. I learned something new!