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

Re: For 1.5.9: attachment counting for index display



David Champion wrote:
* On 2005.09.13, in <20050913090419.GE6845@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
*       "Thomas Roessler" <roessler@xxxxxxxxxxxxxxxxxx> wrote:

I haven't read the patch recently.

One question, though:  Would it imply that mutt would have to parse
every single message in a mail folder?  Or even every single new
message?


Not exactly.  It still (as always) parses messages only as necessary.
That is, if a %X appears in the $index_format, then messages are parsed
when they are displayed on screen (when the $index_format is evaluated).
If they are never displayed, or if the %X appears within a false
conditional (e.g., %?M?), they are never parsed.

If the user applies a ~X pattern, those messages to which the pattern
is applied are parsed.  (I.e., "~X 2" would parse all messages in the
folder, whereas "~f joe ~X 2" would parse all messages from joe.)



In that case, be prepared for it to increase mutt's memory
consumption significantly.  (I.e., in that case, I wouldn't like it
to be committed.)


But again, its steps here are to parse the message, determine the
attachment information (a simple integer), and free the parse tree, then
to move on to the next message.  That is, it never uses more memory than
it requires for a single message's parse tree, and it never has.  See
Message-ID: <20000621120429.A21019@xxxxxxxxxxxxxxxxxx>.

My best proposal as yet is to cache that result, so that a parse is
required only once per message per session, and still killing the parse
tree once that datum is obtained.  If the attach-allow, etc. settings
were changed, the cached values would be invalidated.

I don't know for sure that it would go in, but how about a version that
hard codes the attachment recognition logic (fewer variables for users,
less to parse) and caches the attachment count in the envelope?

Attachment: signature.asc
Description: OpenPGP digital signature