On Tue, 23 May 2017, Jani Nikula <jani@nikula.org> wrote: > On Fri, 19 May 2017, Ioan-Adrian Ratiu <adi@adirat.com> wrote: >> I'd like to add a feature to quickly work with mail file sizes >> because using custom scripts / external programs which parse >> maildir contents is slow, and non-intuitive, especially since >> notmuch does incremental parsing and has such a nice emacs UI. > > Before we dive into the details, I guess at least I'd like to see better > rationale for the feature. I don't see myself searching or sorting based > on message size. What's the use case? (I wouldn't mind adding the > message size to the formatted output, but that doesn't require indexing > the size or adding the search support for it.) The use case is very simple: I routinely get big mail and want to know about it to take various actions (extract attach, forward, archive etc). Of course I can always write a script to search the maildir but that takes too long, I'd very much rather have incremental indexing, instant search and a very nice GUI front-end (emacs saved searches in my case). With this series I now have saved searches based on filesize which tell me exactly instantly how many messages I have in a certain size range. > > One fundamental issue David noted on IRC, it'll be hard to decide what > to index for "message" size when there are duplicates that typically > have different sizes. For other things, we've indexed whatever comes > first, but I suppose we'd like to fix that. Yes, agreed, and I'll go even further: notmuch search shows thread results - what I did in this patch series is sum up the total messages file sizes in a thread for the search results. We could do something similar, i.e. add all duplicate file sizes to the "message" size and those in turn get added to a thread size. I'm not saying we should necessarily do this, I'm just pointing it out as an alternative which would work very well for me. Ionel > > BR, > Jani. > >> >> >> Ioan-Adrian Ratiu (11): >> lib: message: index message file sizes >> lib: database: store message filesize & add range processor >> notmuch-search: add filesize based sort order >> emacs: make notmuch-search-oldest-first generic >> emacs: notmuch-search: add filesize sorting >> sprinter: add unsigned_long printer function >> lib: thread: add thread total size function >> notmuch-search: output total_filesize thread result >> notmuch-show: export message filesize >> emacs: notmuch-search: add display thread sizes capability >> emacs: notmuch-show: add filesize to headerline >> >> devel/schemata | 1 + >> doc/notmuch-emacs.rst | 4 ++-- >> emacs/notmuch-hello.el | 24 +++++++++++++----------- >> emacs/notmuch-jump.el | 11 +++++------ >> emacs/notmuch-lib.el | 9 ++++++--- >> emacs/notmuch-show.el | 5 ++++- >> emacs/notmuch-tree.el | 2 +- >> emacs/notmuch.el | 48 +++++++++++++++++++++++++++++++++--------------- >> lib/database-private.h | 1 + >> lib/database.cc | 6 ++++++ >> lib/index.cc | 10 ++++++++++ >> lib/message-file.c | 18 +++++++++++++++++- >> lib/message.cc | 29 +++++++++++++++++++++++++++++ >> lib/notmuch-private.h | 16 ++++++++++++++++ >> lib/notmuch.h | 21 +++++++++++++++++++++ >> lib/query.cc | 6 ++++++ >> lib/thread.cc | 12 ++++++++++++ >> notmuch-search.c | 8 +++++++- >> notmuch-show.c | 5 +++++ >> sprinter-json.c | 9 +++++++++ >> sprinter-sexp.c | 9 +++++++++ >> sprinter-text.c | 9 +++++++++ >> sprinter.h | 1 + >> 23 files changed, 223 insertions(+), 41 deletions(-) >> >> -- >> 2.13.0 >> >> _______________________________________________ >> notmuch mailing list >> notmuch@notmuchmail.org >> https://notmuchmail.org/mailman/listinfo/notmuch