Feature idea: Emacs 'notmuch-search' "paged" display

Subject: Feature idea: Emacs 'notmuch-search' "paged" display

Date: Fri, 17 Jan 2020 13:42:01 +0100

To: notmuch@notmuchmail.org


From: Thomas Schwinge


I had this following idea, but my Emacs foo is too limited to start
implementing this -- if reasonably possible at all.

Here is -- I suppose, not verified -- what happens if you do a
command-line 'notmuch search [...] | less': the 'notmuch' process creates
some output and the 'less' process reads some.  At some point, 'less'
stops reading (let's assume when the screen is full, for simplicity),
then the pipe gets filled up (some few KiB, I think?), and then 'notmuch'
blocks in 'write', so doesn't do any futher work until 'less' reads more

Here is -- I suppose, not verified -- what happens if you do a Emacs
'notmuch-search [...]': the 'notmuch' process creates some output and the
Emacs process reads some.  And then some more, and again, and so on,
until 'EOF'.  So, 'notmuch' never blocks in 'write', because Emacs reads
it all.

Now, I have a number of generic search queries that produce a long list
of search results, so to avoid Emacs building up a huge 'notmuch-search'
buffer I usually quickly do "M-: (ignore-errors (interrupt-process))".
Oftentimes I'm only interested in the first few results, or I'm
immediately going to 'notmuch-search-filter' the results.

Is it possible in Emacs to emulared the "paged" display as explained in
the 'less' example?  That is, only read in "a screenful of data", then
let the pipe fill up, then 'notmuch' block, and only once the user moves
the point towards the end of the current Emacs buffer, continue to read
data from the pipe.

I'm willing to try implementing this, but I'd appreciate some
sanity-checking as well as guidance by somebody more familiar with Emacs

signature.asc (application/pgp-signature)
notmuch mailing list