[Top] [All Lists]

[Nmh-workers] A MH-inspired Maildir handler: coma

2011-02-14 08:33:28


having seen the latest posts here about the future of MH, I thought I
should present you a project I've been working on since last year:
coma, my console mail user agent.

Its design is largely influenced by MH, but so far I only read about MH
and never really used it on a daily basis, so please correct me if I get
things wrong.

Like MH, coma works on local files, but it uses Maildir instead of
MH-style folders.  This has several advantages:

- Maildir is widely supported (as IMAP backing store, from other MUAs)
- IMAP syncing is available via offlineimap
- Maildir supports "flags" such as "seen", "replied"
- Atomic delivery is possible

Unfortunately, Maildir also makes some things more complex: you don't
want to write out the filenames because they are long and cryptic, and
there is no predefined order on mails.  Instead, coma uses a "reading
sequence" (not unlike MH sequences) where you specifies the order you
currently read mails in.

coma is designed to support large mailboxes; all mail is parsed *once*
on first time seen (first inc/scan) and relevant headers are cached
(in a DBM-style database).  This is possible because Maildir filenames
can be considered invariant.  Common queries thus never hit the
filesystem.  (Rescanning folders is unavoidable with Maildirs,
however, but modern file systems do well enough.)

coma natively supports MIME and UTF-8 as well as threading using jwz's

I thus devised an MH-inspired, but not equivalent set of commands.
Coma commands are dispatched in a script aliased to ",":

, inc searches for fresh messages in new/ and copies them to cur/,
showing which folders have new messages (roughly, like flist).
, folders lists all folders.

, read sets up the reading sequence, specifying folders, filters and
order.  , scan displays the reading sequence, possibly refiltering and
reordering.  (, scan is like a , read which just displays but does not
store the new sequence.)  E.g.:

% , read +lispmachines -last 10
   1  2006-08-19  Paolo Amoroso      Re: [lispmachines] Microexplorer manuals   
   2  2006-08-19  Hans Huebner         [lispmachines] Microexplorer manuals     
   3  2006-08-19  al_kossow            [lispmachines] Re: Microexplorer manuals 
   4  2006-08-19  Brad Parker        Re: [lispmachines] Microexplorer manuals   
   5  2006-10-26  viantalum01        [lispmachines] ZetaLisp conversion to somet
   6  2006-11-06  conrad bookout     Re: [lispmachines] ZetaLisp conversion to s
   7  2006-11-19  Harvie Griffith J    [lispmachines] ZetaLisp conversion to som
   8  2006-11-24  conrad bookout         [lispmachines] ZetaLisp conversion to s
   9  2006-11-29  staypufd2002             [lispmachines] Re: ZetaLisp conversio
  10  2008-02-11  brianpriday        [lispmachines] MacIvory 2 sale eBay UK     

% , scan from:con reverse date
   8  2006-11-24  conrad bookout     Re: [lispmachines] ZetaLisp conversion to s
   6  2006-11-06  conrad bookout     Re: [lispmachines] ZetaLisp conversion to s

Note that sequence numbers always are "local" to the current reading list.

, show displays messages, rendering MIME to plain text. , next / , prev
show the next/prev message in the reading list.  , att displays and
extracts attachments.  MIME support is quite ad-hoc for now, but
works on real world mail already.

, mail / , repl / , forw to send mail.  MIME generation is supported
with a very simple mhbuild-style syntax like "#text/plain /etc/passwd".

read/scan operate on a powerful query language that can express
things like "+INBOX ( subj:foo | subj:bar ) date>2009-01-01 unreplied"

Also, reading lists are not limited to single folders:

% , read +INBOX +mh-workers thread unseen

Full-text search is possible with external tools, e.g. mairix:

% , scan $(mairix -r ...)

Things missing but planned:

- named/multiple sequences
- searching custom fields
- multiple contexts
- GPG support
- (possibly) webmail client with the same light interface

coma has been released to the public domain, its source can be found at

It is written in Ruby 1.8, but only consists of two files with quite
simple ~1.2kloc and has no dependencies except an optional better
caching storage.

I'm not yet using coma for my daily mail, but it's pretty close to it.
From the die-hard MH users, I'd now like to know:

- Given above command lists, which important commands/functionality do
  you think are missing that MH provides?

- coma represents flags (seen, replied, ...) "externally".  If I add
  sequences anyway, would it be a good idea to represent them as
  (possibly "virtual" sequences), too?  Or do you consider the MH
  "unread"-sequence a hack?  Should sequences span folders/be global?

And please ask if anything is unclear.

Thanks for reading,
Christian Neukirchen  <chneukirchen(_at_)gmail(_dot_)com>  

Nmh-workers mailing list

<Prev in Thread] Current Thread [Next in Thread>