[PATCH 0/4] First step of 'show' rewrite

Austin Clements amdragon at MIT.EDU
Sun Nov 27 18:21:07 PST 2011


This is the first step in my rewrite of notmuch-show.  Currently, MIME
traversal is controlled by show_message_body, which invokes formatter
callbacks.  As a result, formatters have no control over traversal,
which complicates formatters and makes others (like raw) nigh
impossible to implement correctly.  The callback-driven approach
forces formatters to be written in many small pieces and masks the
true control flow.  It also results in an wide interface with
show_message_body that has been getting wider over time.

The goal of this rewrite is to reverse this relationship, so that
formatters control MIME traversal.  This lets formatters traverse the
MIME in the most appropriate way, eliminates the callbacks, makes the
control flow through a formatter clear, and dramatically narrows
interfaces.

This first series doesn't change the way formatters work, but it does
introduce the MIME-traversal API they'll use.  This API consists of a
total of two functions: one to get the root MIME part of a message and
one to get a child of a MIME part.  This allows basic MIME traversal
to be implemented in a simple, two-line for loop.  The series also
updates show_message_body to use this new API, though ultimately
show_message_body will go away entirely.



More information about the notmuch mailing list