Re: Visualising contents of a Maildir

2022-08-19 Thread Sam Kuper
On Fri, Aug 19, 2022 at 09:08:01AM +0200, martin f krafft via Mutt-users wrote:
> Regarding the following, written by "Victor Goff" on 2022-08-18 at 20:09 Uhr 
> -0400:
>> I have used https://tmate.io for those on Windows and those with a
>> small amount of experience with computers in general.  Since you can
>> share a browser, and they can either type with you or not, and they
>> do not necessarily need to even generate ssh keys, this is a point
>> of allowing that to happen easily.
> 
> Nice, but this isn't going to be a live presentation, so it really has
> to be a PDF.

Well, you could:

- set up Mutt instance as previously suggested (e.g. use muttrc/whatever
  to capture key-presses other than Up, Down, PgUp, and PgDn), on an
  internet-connected machine that can accept SSH connections

- log in to Mutt instance via tmate.io or other web-based SSH gateway

- share link (URL) to intended recipients.


Re: Visualising contents of a Maildir

2022-08-19 Thread martin f krafft via Mutt-users

Regarding the following, written by "Victor Goff" on 2022-08-18 at 20:09 Uhr 
-0400:
I have used https://tmate.io for those on Windows and those with a small 
amount of experience with computers in general.  Since you can share a 
browser, and they can either type with you or not, and they do not 
necessarily need to even generate ssh keys, this is a point of allowing 
that to happen easily.


Nice, but this isn't going to be a live presentation, so it really 
has to be a PDF.


--
@martinkrafft | https://matrix.to/#/#madduck:madduck.net
 
in the beginning was the word,

and the word was content-type: text/plain
 
spamtraps: madduck.bo...@madduck.net


Re: Visualising contents of a Maildir

2022-08-18 Thread Victor Goff
On Thu, Aug 18, 2022 at 01:02:39PM -0500, Derek Martin wrote:
> On Thu, Aug 18, 2022 at 09:17:11AM +, Sam Kuper wrote:
> > On Wed, Aug 17, 2022 at 04:59:41PM -0500, Derek Martin wrote:
> > Or they could just use SSH.
> 
> SSH is ubiquitous.  But outside of tech circles, the ability to use it
> is not.  If you've ever sat in a meeting with a bunch of pure
> management types, you'll understand why this suggestion is a
> non-starer.  Likewise for your other suggestions.

I have used https://tmate.io for those on Windows and those with a small
amount of experience with computers in general.  Since you can share a
browser, and they can either type with you or not, and they do not
necessarily need to even generate ssh keys, this is a point of allowing
that to happen easily.

It allows those to connect using an https connection that may not be
able to join in on a terminal session directly via ssh.



Re: Visualising contents of a Maildir

2022-08-18 Thread martin f krafft via Mutt-users

Regarding the following, written by "Derek Martin" on 2022-08-18 at 15:23 Uhr 
-0500:
If this is all you need to do, then, do you really need to preserve 
the threading?


Excellent point, and the answer is no. It helps with:


enough info to demonstrate their uniqueness.


but I can just throw the Message-ID in there as well. Confuse them a 
bit ;)


Threading visualised would just make it visually more appealing and 
clearer. But it is certainly not required, and heck: most people in 
the Windows world don't even understand what it is. :rofl:


But damn you for mentioning formail. You know I'll now hack together 
a one-liner trial-and-error-style, rather than just to sit down and 
do it in Python, which might take longer, but will be infinitely 
better in the long run.


Thanks,
-m

PS: (signature randomly chosen)

--
@martinkrafft | https://matrix.to/#/#madduck:madduck.net
 
(on the statement print "42 monkeys"+"1 snake") btw,

both perl and python get this wrong.
perl gives 43 and python gives "42 monkeys1 snake",
when the answer is clearly "41 monkeys and 1 fat snake".
   -- jim fulton
 
spamtraps: madduck.bo...@madduck.net


digital_signature_gpg.asc
Description: Digital GPG signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)


Re: Visualising contents of a Maildir

2022-08-18 Thread Derek Martin
On Thu, Aug 18, 2022 at 10:10:38AM +0200, martin f krafft via Mutt-users wrote:
> Thanks for your responses so far!
> 
> The reason I need this index is that I have to provide evidence of "a huge
> volume of mails" on a given topic, without actually sharing the emails.

If this is all you need to do, then, do you really need to preserve
the threading?  Seems all you really need is a list of the messages
for the given subject, presumably with enough info to demonstrate
their uniqueness.  Assuming you or someone else on your behalf can get
at them, you can probably get what you need from the mail system's
logs.  Or you can use formail to spit out just the headers that are
interesting from your maildir folder...  Something like this:

  cd $mail_folder/cur
  for file in *; do
formail -X from: -X subject: -X date:
  done > some_output_file

This will give you a bunch of groups of 3 lines that contain the three
headers for each message.  There should always be 3 lines (unless you
have some broken messages that excluded any of those headers, which
can happen, but shouldn't)--but they probably won't always be in the
same order.  You can, of course, specify additional headers...

The formail command provides -x and -X options; -x extracts just the
header value, whereas -X extracts the full header line.  You want -X
so you know which header you're looking at, so you don't have to write
code to try to figure it out heuristically.

You can do all of the above entirely in Python, which avoids the nasty
quoting problems with constructions like "for file in *; ..." by using
os.scandir(), and using the subprocess module (or similar) to execute
the formail command for each message file.  It also makes it possible
to know that a given line of output is for the specific file you're
asking about, so the ordering and potential absence of the message's
headers becomes a non-concern.   Then you can read the output line by
line, assigning the header value to a dict field based on the header
name.  Stuff your dicts in a list, or something.

Then you can pass your dicts to, say, csv.DictWriter, and write them
out as a CSV file.  Or as JSON.  Or add records for them to a
database, so you can query the data.   Or whatever.  If you really
do need to show the thread graph, you can produce that yourself using
the message IDs and references.

Is any of this better than just using Python's email module?  Probably
not... YMMV.  But either way, if I had to solve this I would just use
Python, and not try to hack around with other utilities.

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



signature.asc
Description: PGP signature


Re: Visualising contents of a Maildir

2022-08-18 Thread Derek Martin
On Thu, Aug 18, 2022 at 01:02:39PM -0500, Derek Martin wrote:
> On Thu, Aug 18, 2022 at 09:17:11AM +, Sam Kuper wrote:
> > On Wed, Aug 17, 2022 at 04:59:41PM -0500, Derek Martin wrote:
> > > On Wed, Aug 17, 2022 at 09:33:44PM +, Sam Kuper wrote:
> > Or they could just use SSH.
> 
> SSH is ubiquitous.  But outside of tech circles, the ability to use it
> is not.  If you've ever sat in a meeting with a bunch of pure
> management types, you'll understand why this suggestion is a
> non-starer.  Likewise for your other suggestions.

Granted, I'm making assumptions about the audience, but given the
nature of the task, I think they are safe ones. ;-)

Also, even for tech-oriented audiences, making them ssh into a machine
and run mutt to view the index will feel like "making us jump through
hoops..."  It's extremely likely, in my estimation, that it's not
going to go over well with the audience, regardless of who the
audience is.

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



signature.asc
Description: PGP signature


Re: Visualising contents of a Maildir

2022-08-18 Thread Derek Martin
On Thu, Aug 18, 2022 at 10:10:38AM +0200, martin f krafft via Mutt-users wrote:
> > I don't think it will be better or easier than what you've done.  But
> > you could try using a '|' filter in $index_format to append some output
> > to a file as a side effect.  It would still entail manually pgdn'ing
> > through the index.
> 
> Not a bad idea, but unfortunately, the Unicode characters used to represent
> threads in mutt's index seem to be some sort of ncurses-special

They are not--they're standard Unicode (IIRC they can also be replaced
by ASCII characters with a config option, but I don't recall the
details).

If this is a limitation for you, perhaps if you explain the context of
the limitation, we can help you overcome it.

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



signature.asc
Description: PGP signature


Re: Visualising contents of a Maildir

2022-08-18 Thread Derek Martin
On Thu, Aug 18, 2022 at 09:17:11AM +, Sam Kuper wrote:
> On Wed, Aug 17, 2022 at 04:59:41PM -0500, Derek Martin wrote:
> > On Wed, Aug 17, 2022 at 09:33:44PM +, Sam Kuper wrote:
> >> On Wed, Aug 17, 2022 at 09:22:31PM +0200, martin f krafft via Mutt-users 
> >> wrote:
> >> > For reasons you don't want to know,
> >> 
> >> You may be underestimating the curiosity of your audience.
> > 
> > I suspect what Sam really meant was, "For reasons that would make you
> > sad if you knew..." =8^)
> 
> I think you mean Martin rather than Sam, but that's OK :)

Indeed!  :)

> >>> Is there a way to "screenshot" the Mutt index beyond the scroll
> >>> window?
> >> 
> >> Why would you need to?  In what way does Mutt itself not meet your
> >> requirements?
> > 
> > Presumably because in order to *share* such a visualization, i.e. with
> > someone remote, they would have to have a copy of the inbox AND run
> > Mutt.
> 
> Or they could just use SSH.

SSH is ubiquitous.  But outside of tech circles, the ability to use it
is not.  If you've ever sat in a meeting with a bunch of pure
management types, you'll understand why this suggestion is a
non-starer.  Likewise for your other suggestions.

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



signature.asc
Description: PGP signature


Re: Visualising contents of a Maildir

2022-08-18 Thread martin f krafft via Mutt-users

Regarding the following, written by "Bastian" on 2022-08-18 at 14:48 Uhr +0200:
1981% mutt > /dev/shm/o 
 *blindly pressing q* 
bastian@t6l ~ 
1982% wc /dev/shm/o 
  1  599 6251 /dev/shm/o


```
lotus:/dev/shm% mutt > /dev/shm/mutt || echo $? 
  #(pts/3) 18 17:51:11.605
1
```

--
@martinkrafft | https://matrix.to/#/#madduck:madduck.net
 
why didn't noah swat those two mosquitoes?
 
spamtraps: madduck.bo...@madduck.net


Re: Visualising contents of a Maildir

2022-08-18 Thread raf via Mutt-users
On Thu, Aug 18, 2022 at 10:10:38AM +0200, martin f krafft via Mutt-users 
 wrote:

> Thanks for your responses so far!
> 
> The reason I need this index is that I have to provide evidence of "a huge
> volume of mails" on a given topic, without actually sharing the emails. So I
> need a PDF index. Hence I thought making an HTML table, and then printing
> that. Easiest.
> 
> A screenshot/bitmap approach would be very hard to turn into a useable PDF,
> I think.
> 
> Sam is right, threads are digraphs, but Mutt displays them in a table, and I
> think that's a good compromise.
> 
> > I don't think it will be better or easier than what you've done.  But
> > you could try using a '|' filter in $index_format to append some output
> > to a file as a side effect.  It would still entail manually pgdn'ing
> > through the index.
> 
> Not a bad idea, but unfortunately, the Unicode characters used to represent
> threads in mutt's index seem to be some sort of ncurses-special, and the
> whole thing would need parsing. But this is definitely an interesting
> approach, as I could probably craft an `$index_format` that generates HTML
> ``'s, and PgDn'ing over a thousand messages might be something the X
> repeat buffer can do. ;)
> 
> I knew why I'd ask here! ;)
> 
> Thanks,
> 
> -- 
> @martinkrafft | https://matrix.to/#/#madduck:madduck.net
> "i worked myself up from nothing to a state of extreme poverty."
>  -- groucho marx
> spamtraps: madduck.bo...@madduck.net

Perhaps notmuch's json output with threading that you mentioned
can be fed into jq which could transform it into csv.

cheers,
raf



Re: Visualising contents of a Maildir

2022-08-18 Thread Bastian
On 18Aug22 12:00+0200, martin f krafft via Mutt-users wrote:
> Regarding the following, written by "Bastian" on 2022-08-18 at 11:41 Uhr 
> +0200:
> > --- paste: % LINES=10 COLUMNS=1 mutt $OPTIONS > maildir.out ---
> > eop

Oh, I am sorry to hear that. I tested it on my side before and it 
piped a lot from the redirected stream into the file.

Here again:

--- paste:
bastian@t6l ~
1981% mutt > /dev/shm/o
  *blindly pressing q*
bastian@t6l ~
1982% wc /dev/shm/o
   1  599 6251 /dev/shm/o

--- eop

The file /dev/shm/o contains lots and lots of control characters. So 
this would be another task to get them stripped; less -r does it.


-- 
Bastian


Re: Visualising contents of a Maildir

2022-08-18 Thread martin f krafft via Mutt-users

Regarding the following, written by "Christian Brabandt" on 2022-08-18 at 13:15 
Uhr +0200:
I wonder if you can make use of public-inbox, which is e.g. used to 
create the git mailinglist archive. It's not pretty, but generates a 
threaded mail archive from a Maildir, IIRC. Not sure how easy enough it 
is to add date and from header


https://github.com/nojb/public-inbox


Also a good idea! Mail archivers!

--
@martinkrafft | https://matrix.to/#/#madduck:madduck.net
 
"when a gentoo admin tells me that the KISS principle is good for

 'busy sysadmins', and that it's not an evolutionary step backwards,
 i wonder whether their tape is already running backwards."
 
spamtraps: madduck.bo...@madduck.net


Re: Visualising contents of a Maildir

2022-08-18 Thread Christian Brabandt


On Mi, 17 Aug 2022, martin f krafft via Mutt-users wrote:

> Folks,
> 
> This isn't really a Mutt question, but you're the kind of people that most
> likely would have good answers on the following:
> 
> For reasons you don't want to know, I have to visualise a Maildir with a
> couple of thousand messages, i.e. essentially provide a mutt-style index
> with correspondents, dates, subjects, and threading, ideally in form of an
> HTML table.
> 
> Apart from the threading, Python's email module can do most of the work, and
> combined with e.g. Jinja templating, I should be able to get results
> quickly, but since I don't like reinventing wheels, I was wondering if maybe
> you had a better idea?
> 
> Is there a way to "screenshot" the Mutt index beyond the scroll window?
> 
> Or can you think of command-line tools that visualise threads? Notmuch,
> which I use, can very quickly list all the threads, including the count of
> messages, but I actually need to list to be *really big* and not condensed,
> for reasons you don't want to know.
> 
> I can make notmuch output json with threading, and then process that with
> Python to create a list, but maybe there's a better tool?

I wonder if you can make use of public-inbox, which is e.g. used to 
create the git mailinglist archive. It's not pretty, but generates a 
threaded mail archive from a Maildir, IIRC. Not sure how easy enough it 
is to add date and from header

https://github.com/nojb/public-inbox

regards,
Christian
-- 
 "PLEASE RESPECT INTELLECTUAL RIGHTS!"
 "Please demonstrate intellect." ;)


Re: Visualising contents of a Maildir

2022-08-18 Thread martin f krafft via Mutt-users

Regarding the following, written by "Bastian" on 2022-08-18 at 11:41 Uhr +0200:
--- paste: 
% LINES=10 COLUMNS=1 mutt $OPTIONS > maildir.out 
--- eop


This does not generate any output for me, i.e. the generated file is 
empty.


--
@martinkrafft | https://matrix.to/#/#madduck:madduck.net
 
chaos reigns within.

reflect, repent, reboot.
order shall return.
 
spamtraps: madduck.bo...@madduck.net


Re: Visualising contents of a Maildir

2022-08-18 Thread Sam Kuper
On Thu, Aug 18, 2022 at 10:45:04AM +0100, Sam Kuper wrote:
> If you find a lightweight markup language that has PDF output AND has
> table markup tags that correspond one-to-one with the '|' filter's
> ncurses strings, then you could use the `|` filter as Kevin proposes
> above, and pipe the output through sed to replace the ncurses strings
> with lightweight markup language strings.
> 
> If you really need PDF output, then this may well be the best
> approach.

This approach (lightweight markup + sed) might also work with Bastian's
suggestion, in another branch of this thread, to use stdout instead of
the `|` filter.

Sam


Re: Visualising contents of a Maildir

2022-08-18 Thread Sam Kuper
On Thu, Aug 18, 2022 at 10:10:38AM +0200, martin f krafft via Mutt-users wrote:
> The reason I need this index is that I have to provide evidence of "a
> huge volume of mails" on a given topic, without actually sharing the
> emails.

OK, but...

> So I need a PDF index.

That is a non-sequitur.

In another branch of this thread, I proposed several ways to provide the
evidence you need, without sharing the emails AND without creating PDFs.

So, unless achieving a PDF is a *requirement* (in which case it might
have been helpful to mention that in the first place!), generating a PDF
just seems to be an unnecessary headache.


> Hence I thought making an HTML table, and then printing that. Easiest.

Maybe.

Or you could use a lightweight markup language (lighter than HTML) that
has tables, and a relevant PDF generator for that markup language.

If you like that idea, here's a handy table showing which lightweight
markup languages have tables:

https://en.wikipedia.org/w/index.php?title=Lightweight_markup_language=1104650806#Comparison_of_language_features

and here's another useful table showing which lightweight markup
languages also offer PDF output:

https://en.wikipedia.org/w/index.php?title=Lightweight_markup_language=1104650806#Comparison_of_implementation_features


> A screenshot/bitmap approach would be very hard to turn into a useable
> PDF, I think.

Depends what you mean by "usable".  If all you need is e.g. an image per
PDF page, several tools can trivially achieve that (e.g. `img2pdf`).

Some tools can also compress the images for you, or you can pipe the
images via compression tools before assembling the PDF, to avoid
creating a humungous PDF.


> Sam is right, threads are digraphs, but Mutt displays them in a table,
> and I think that's a good compromise.

Fair point, if you're also going to capture the ASCII art that indicates
the thread structure.


>> I don't think it will be better or easier than what you've done.
>> But you could try using a '|' filter in $index_format to append some
>> output to a file as a side effect.  It would still entail manually
>> pgdn'ing through the index.
> 
> Not a bad idea, but unfortunately, the Unicode characters used to
> represent threads in mutt's index seem to be some sort of
> ncurses-special, and the whole thing would need parsing. But this is
> definitely an interesting approach, as I could probably craft an
> `$index_format` that generates HTML ``'s, and PgDn'ing over a
> thousand messages might be something the X repeat buffer can do. ;)

If you find a lightweight markup language that has PDF output AND has
table markup tags that correspond one-to-one with the '|' filter's
ncurses strings, then you could use the `|` filter as Kevin proposes
above, and pipe the output through sed to replace the ncurses strings
with lightweight markup language strings.

If you really need PDF output, then this may well be the best approach.

All best,

Sam


Re: Visualising contents of a Maildir

2022-08-18 Thread Bastian
On 18Aug22 10:38+0200, martin f krafft via Mutt-users wrote:
> Not a bad idea to use the screendump functionality of X terminals. But I am
> talking thousands of lines… doubt this will work, but if it does, I'll
> report back.

Probably this could work:

--- paste:
% LINES=10 COLUMNS=1 mutt $OPTIONS > maildir.out
--- eop

You need to find the OPTIONS that mutt enters your mailbox of interest; 
and then quit it blindly.


Cheers,
-- 
Bastian


Re: Visualising contents of a Maildir

2022-08-18 Thread Sam Kuper
On Wed, Aug 17, 2022 at 04:59:41PM -0500, Derek Martin wrote:
> On Wed, Aug 17, 2022 at 09:33:44PM +, Sam Kuper wrote:
>> On Wed, Aug 17, 2022 at 09:22:31PM +0200, martin f krafft via Mutt-users 
>> wrote:
>> > For reasons you don't want to know,
>> 
>> You may be underestimating the curiosity of your audience.
> 
> I suspect what Sam really meant was, "For reasons that would make you
> sad if you knew..." =8^)

I think you mean Martin rather than Sam, but that's OK :)


>>> Is there a way to "screenshot" the Mutt index beyond the scroll
>>> window?
>> 
>> Why would you need to?  In what way does Mutt itself not meet your
>> requirements?
> 
> Presumably because in order to *share* such a visualization, i.e. with
> someone remote, they would have to have a copy of the inbox AND run
> Mutt.

Or they could just use SSH.

If the person viewing the visualization should be prevented from
modifying the inbox, then Mutt could be invoked with the `-R`
(read-only) option.

If the person viewing the visualization should be prevented from seeing
the *content* of any of the mails in the inbox, then either:

1.  Configure the muttrc, or the shell hosting Mutt, or Mutt itself
(edit source and recompile), to intercept and discard any keypresses
other than the ones for scrolling up and down Mutt's index.

I'd probably attempt those options in that order.

2.  Alternatively (or additionally), the underlying message files in the
Maildir on the filesystem could be stripped, using a script (Python,
Bash, whatever) of all but their headers.  This would have some
perhaps undesirable side-effects, though: it would affect some
fields displayed in Mutt's index view, such as the number of
attachments.

I probably wouldn't bother with this unless the underlying messages'
contents were especially sensitive (e.g. sensitive personal or
commercial information).

3.  Alternatively (or additionally) again, those underlying message
files could instead have their content and attachments replaced by
an equivalent quantity of Lorem Ipsum, to at least keep file sizes
and number of attachments constant.

I probably wouldn't bother with this unless the underlying messages'
contents were especially sensitive (e.g. sensitive personal or
commercial information) AND the file size / number of attachments
metadata were of interest.



> Presumably what you'd want is an image or document that contains the
> desired visualization, that can be displayed by some common tool
> available to the general community, like a web browser,
> company-installed word processor or similar productivity app, etc..

SSH is very widely available.  It's installed by default on GNU/Linux,
and most Unixes including macOS.  It is available for Windows via PuTTY
or Windows Subsystem for Linux.


> Mutt could still meet the need, though it would be some work.  You
> could screenshot each individual page of the index, and then use an
> image editing program to assemble them together.  Maybe--if the
> resulting image was not too large for your application to handle.  Or
> you could just paste each image into a document in a word processor,
> one image per page...

Or use tmux or GNU Screen to copy/paste into a text document?  But
still, creating a whole new interface onto the index view from scratch
seems over-elaborate when Mutt's index view already works perfectly
well.


> It might be possible to create a virtual desktop large enough to
> display the entire index at once, and then use imagemagick or similar
> to capture the window to a file, but I suspect there again you may run
> into memory problems.

Or, again, use tmux or GNU Screen to copy/paste from the virtual desktop
into a text document?  Again, though, building a whole new interface
onto the index view from scratch seems over-elaborate when Mutt's index
view already works perfectly well.

Sam


Re: Visualising contents of a Maildir

2022-08-18 Thread martin f krafft via Mutt-users

Regarding the following, written by "Marcus C. Gottwald" on 2022-08-18 at 09:53 
Uhr +0200:
So, if one of these output formats would be a step forward, and you 
found a way to make an xterm window enormously large,


Not a bad idea to use the screendump functionality of X terminals. 
But I am talking thousands of lines… doubt this will work, but if it 
does, I'll report back.


--
@martinkrafft | https://matrix.to/#/#madduck:madduck.net
 
fighting for peace is like screwing for virginity.

   -- the irish times, washington dc
 
spamtraps: madduck.bo...@madduck.net


Re: Visualising contents of a Maildir

2022-08-18 Thread Marcus C. Gottwald


martin f krafft via Mutt-users wrote (Wed 2022-Aug-17 21:22:31 +0200):

> Is there a way to "screenshot" the Mutt index beyond the scroll
> window?

xterm can create decent screenshots in HTML or SVG format. The HTML
version essentially is one big  using CSS and s for
colors and other highlighting; the SVG version places characters at
their pixel-position on the SVG canvas.

I can reach those functions using Ctrl + left mouse button, "XHTML
Screen Dump" and "SVG Screen Dump". The files are called something
like "xterm.2022.08.18.09.23.33.xhtml"; not exactly sure where they
get created (home dir? working dir?).

So, if one of these output formats would be a step forward, and you
found a way to make an xterm window enormously large, and you found
a way to trigger xterm's "screen dump" function (if you don't want
to do that manually), then you could use Mutt running in the xterm
window...

Cheers, Marcus

-- 
   Marcus C. Gottwald  ··  @mcg:cheers.de



Re: Visualising contents of a Maildir

2022-08-18 Thread martin f krafft via Mutt-users

Thanks for your responses so far!

The reason I need this index is that I have to provide evidence of 
"a huge volume of mails" on a given topic, without actually sharing 
the emails. So I need a PDF index. Hence I thought making an HTML 
table, and then printing that. Easiest.


A screenshot/bitmap approach would be very hard to turn into a 
useable PDF, I think.


Sam is right, threads are digraphs, but Mutt displays them in a 
table, and I think that's a good compromise.


I don't think it will be better or easier than what you've done.  But 
you could try using a '|' filter in $index_format to append some 
output to a file as a side effect.  It would still entail manually 
pgdn'ing through the index.


Not a bad idea, but unfortunately, the Unicode characters used to 
represent threads in mutt's index seem to be some sort of 
ncurses-special, and the whole thing would need parsing. But this is 
definitely an interesting approach, as I could probably craft an 
`$index_format` that generates HTML ``'s, and PgDn'ing over a 
thousand messages might be something the X repeat buffer can do. ;)


I knew why I'd ask here! ;)

Thanks,

--
@martinkrafft | https://matrix.to/#/#madduck:madduck.net
 
"i worked myself up from nothing to a state of extreme poverty."

 -- groucho marx
 
spamtraps: madduck.bo...@madduck.net


Re: Visualising contents of a Maildir

2022-08-17 Thread Kevin J. McCarthy

On Wed, Aug 17, 2022 at 09:22:31PM +0200, martin f krafft via Mutt-users wrote:
Is there a way to "screenshot" the Mutt index beyond the scroll 
window?


I don't think it will be better or easier than what you've done.  But 
you could try using a '|' filter in $index_format to append some output 
to a file as a side effect.  It would still entail manually pgdn'ing 
through the index.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Visualising contents of a Maildir

2022-08-17 Thread Derek Martin
On Wed, Aug 17, 2022 at 09:33:44PM +, Sam Kuper wrote:
> On Wed, Aug 17, 2022 at 09:22:31PM +0200, martin f krafft via Mutt-users 
> wrote:
> > For reasons you don't want to know,
> 
> You may be underestimating the curiosity of your audience.

I suspect what Sam really meant was, "For reasons that would make you
sad if you knew..." =8^)

> > Is there a way to "screenshot" the Mutt index beyond the scroll
> > window?
> 
> Why would you need to?  In what way does Mutt itself not meet your
> requirements?

Presumably because in order to *share* such a visualization, i.e. with
someone remote, they would have to have a copy of the inbox AND run
Mutt.  This is not typically desireable, when essentially the
equivalent of sharing a document is the sole purpose for it.

Presumably what you'd want is an image or document that contains the
desired visualization, that can be displayed by some common tool
available to the general community, like a web browser,
company-installed word processor or similar productivity app, etc..

Mutt could still meet the need, though it would be some work.  You
could screenshot each individual page of the index, and then use an
image editing program to assemble them together.  Maybe--if the
resulting image was not too large for your application to handle.  Or
you could just paste each image into a document in a word processor,
one image per page...

It might be possible to create a virtual desktop large enough to
display the entire index at once, and then use imagemagick or similar
to capture the window to a file, but I suspect there again you may run
into memory problems.

I'm not sure any of those qualify as "something better..."

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



signature.asc
Description: PGP signature


Re: Visualising contents of a Maildir

2022-08-17 Thread Sam Kuper
On Wed, Aug 17, 2022 at 09:22:31PM +0200, martin f krafft via Mutt-users wrote:
> For reasons you don't want to know,

You may be underestimating the curiosity of your audience.


> I have to visualise a Maildir with a couple of thousand messages, i.e.
> essentially provide a mutt-style index with correspondents, dates,
> subjects, and threading,

So far, so good.  Use Mutt.  It does this very nicely.

(I'm not trying to be facetious - even with my repetitive answers below.
This is a use-case for which Mutt is genuinely well-suited.)


> ideally in form of an HTML table.

This is puzzling, as follows:


- Tables are tabular.

- Threads are digraphs (usually polytrees - although in principle a
  single message can be a reply to *multiple* earlier messages).


So there seems to be something of a topological mismatch between your
intended input data structure and your intended output data structure.



> Apart from the threading, Python's email module can do most of the
> work, and combined with e.g. Jinja templating, I should be able to get
> results quickly, but since I don't like reinventing wheels, I was
> wondering if maybe you had a better idea?

Again, Mutt does this very nicely.  Why not just use Mutt?


> Is there a way to "screenshot" the Mutt index beyond the scroll
> window?

Why would you need to?  In what way does Mutt itself not meet your
requirements?


> Or can you think of command-line tools that visualise threads?

Again: Mutt.

(Emacs can do this, too.  Probably there are other tools as well.)


> Notmuch, which I use, can very quickly list all the threads, including
> the count of messages, but I actually need to list to be *really big*
> and not condensed, for reasons you don't want to know.
> 
> I can make notmuch output json with threading, and then process that
> with Python to create a list, but maybe there's a better tool?

Again, why not just use Mutt?

Sam