<<< Date Index >>>     <<< Thread Index >>>

Re: What's needed for mutt 1.6?



* On 2007.02.22, in <20070222173033.GD2755@xxxxxxxxxxxxxxxxx>,
*       "Brendan Cully" <brendan@xxxxxxxxxx> wrote:
> 1.5.15. So, I'd like to hear once again which patches everyone would
> like to see in 1.6 (and which patches people object to).

I have a new one recently that I never posted:

http://home.uchicago.edu/~dgc/sw/mutt/patch-1.5.13.dgc.nested_if.1

This is a revision to the older "deepif" patch that allows nested
conditionals in format strings.  The "deepif" patch is really awful
syntactically because it depends on escaping the inner nests of if-else
conditions with backslashes, and these expressions quickly become very
difficult to formulate without error.

The solution to this is a container -- when clearly defining the
boundaries of the conditional expression, there's no need to escape
nested expressions. "nested_if" appropriates %<...> for this purpose.
%<...> is already defined as current time in locale, but realistically
it doesn't seem all that useful.  (You'd never want it in $index_format.
You might want it in $status_format, but mutt's screen redraws are
event-driven and not clock-driven anyway, so the current time would
usually be incorrect.  You wouldn't want it in an attribution.  It might
be useful under the fmtpipe patch, but with fmtpipe you can render the
current time however you like, anyway.)

Nonetheless, the change to current behavior is why I never posted it
before, and I can appreciate not wanting to change this.  But I can't
think of any other predictable single-character ascii notations for
containing conditionals.  (I suppose we could choose something like
%<<...>> though.)

Example: an index_format could be

  %5C %Z %[%y%m%d] %-18.18F %<M?<%2M\>&%<H?*%.2H*&%<X?{%2X}&%4c>>> %s
                            ^------------------------------------^

This makes the index show "<%2M>" when a thread is collapsed, or else
"*%.2H*" if it's spam, or else "{%2X}" if it has attachments, or else
%4c if it's just a regular message.  The same notation with the "deepif"
patch would involve a dozen backslashes, and it would not even be
possible with an unpatched mutt.

I've been using this a while, and it seems hardy.  I would like to
tweak it a bit more, but since we're talking about feature freeze here
it seems wise to mention the patch now -- perhaps it could be included
as-is, and changes added later.

What changes?  I would like %<...> to become not just a container for
conditionals, but also an arbitrary grouping container.  To conjure a
simple example, this would allow expressions like "%5.5<%2H %2X>", which
would display at least two characters of %H and at least two characters
of %X, but constrain the pair to 5 characters in total.  This would
essentially mean trying to show both %H and %X, but giving priority to
%H if it expands to more than 2 characters.

-- 
 -D.    dgc@xxxxxxxxxxxx        NSIT    University of Chicago