Re: [S-mailx] Display HTML messages

2020-05-13 Thread Steffen Nurpmeso
Hi Giannis.

giannismicr...@gmail.com wrote in
<5ebb8df0.1c69fb81.2bdca.3...@mx.google.com>:
 |Steffen Nurpmeso  wrote:
 |> I have to apply some corrections to my claim, sorry.
 |> 
 |> Steffen Nurpmeso wrote in
 |> <20200511173946._vy_n%stef...@sdaoden.eu>:
 |>   ...
 |>|Also, if i say "? set mailcap-disable" and then
 |> 
 |> Actually unnecessary, ~/.mailcap is inspected as a second step.
 |> 
 |>|  set pipe-application/pdf='@*=mupdf $MAILX_FILENAME_TEMPORARY'
 |> 
 |> This should be "?*=++? mupdf $MAILX_FILENAME_TEMPORARY" then.
 |> Important is ? not @ (has been deprecated long ago, hmm), and the
 |> ++ to delete the file backing $MAILX_FILENAME_TEMPORARY, otherwise
 |> your $TMPDIR will fill.
 |> 
 |> Or just use an according entry in ~/.mailcap.
 |> What could really make sense is an environment variable that is
 |> passed to ~/.mailcap tests, so that those know the actual command
 |> (i.e., mimeview or print).  Hmm.
 |> 
 |>|mupdf(1) will be spawned even for "print".
 ...
 |Gutten morgen Steffen.

Thank you, it became a new day, sorry!  Greek is one more of those
things that i do know nothing about.  (It is "Guten", here in
Hesse(n) we say "Gude" even, exclusively!, spoken like
"Gde".  I do not say that though :).  We in Darmstadt say
"Morsche!" ("Good morning", but "Morsche" is also "Morgen" aka
"tomorrow"!, and rotten wood is "morsch", but what do i know) and
"Ei, Guuude" (hmm; and is Ei egg or testicle, i wonder).  But
usually nothing of that.  I have to admit i sometimes cannot
counteract a Morsche! with "Guten morgen", so may it be.

 |Your clarifications are really useful, thank you.

Hmm.  I had forgotten.

 |2 more clarifications, please..
 |
 |Even, if i say "? set mailcap-disable", is there an inspection for \
 |the ~/.mailcap ?

That would be a bug.  The `mailcap' command works as usual, but
the mailcap handler cache will neither become built automatically
nor be inspected if that is set.

 |The $TMPDIR will be empty after each boot or am i wrong?

This depends on your operating system and settings i would say.
On FreeBSD you need an explicit knob ("clear_tmp_enable=yes" in
/etc/rc.conf).  However, if you use memory-backed tmpfs aka mfs
(on FreeBSD "tmpmfs=yes" in /etc/rc.conf, i use "tmpfs /tmp tmpfs
defaults,mode=1777,nofail,size=100% 0 0" on Linux), then any data
will not survive a reboot.  :)

 |So if it will not be empty after boot then the addition ++ will be useful.

Well dangling temporary files are a real issue, an annoyance, and
a problem for long living programs / systems, for sure.
For example i have just installed an old Solaris-based
distribution, plus a new dropbear sshd on it, and that produces
one directory in /tmp/ without cleaning that up.

Or put
  text/html; firefox %s; copiousoutput; nametemplate=%s.html
into your ~/.mailcap, it should do what you want.

But i do not recommend that, ok?  If i recall correctly i once had
implemented that if you use "print" (which really is "type" btw)
on only a single message we would use pipe-TYPE/SUBTYPE
etc. handlers, otherwise not.  I have disabled that, and
introduced "mimeview".  It is all a bit restricted and primitive
to this day, sorry for that.  Maybe i really will add another flag
to force usage of handlers regardless of the command in v14.10.0.

Ciao!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Display HTML messages

2020-05-13 Thread giannismicros2
Steffen Nurpmeso  wrote:

> Hello Giannis.
> 
> I have to apply some corrections to my claim, sorry.
> 
> Steffen Nurpmeso wrote in
> <20200511173946._vy_n%stef...@sdaoden.eu>:
>   ...
>  |Also, if i say "? set mailcap-disable" and then
> 
> Actually unnecessary, ~/.mailcap is inspected as a second step.
> 
>  |  set pipe-application/pdf='@*=mupdf $MAILX_FILENAME_TEMPORARY'
> 
> This should be "?*=++? mupdf $MAILX_FILENAME_TEMPORARY" then.
> Important is ? not @ (has been deprecated long ago, hmm), and the
> ++ to delete the file backing $MAILX_FILENAME_TEMPORARY, otherwise
> your $TMPDIR will fill.
> 
> Or just use an according entry in ~/.mailcap.
> What could really make sense is an environment variable that is
> passed to ~/.mailcap tests, so that those know the actual command
> (i.e., mimeview or print).  Hmm.
> 
>  |mupdf(1) will be spawned even for "print".
> 
> Ciao, and greetings to Greece!
> 
> --steffen
> |
> |Der Kragenbaer,The moon bear,
> |der holt sich munter   he cheerfully and one by one
> |einen nach dem anderen runter  wa.ks himself off
> |(By Robert Gernhardt)

Gutten morgen Steffen.

Your clarifications are really useful, thank you.

2 more clarifications, please..

Even, if i say "? set mailcap-disable", is there an inspection for the 
~/.mailcap ?

The $TMPDIR will be empty after each boot or am i wrong?
So if it will not be empty after boot then the addition ++ will be useful.

Regards :) 
Giannis.


Re: [S-mailx] Display HTML messages

2020-05-12 Thread Steffen Nurpmeso
Hello Giannis.

I have to apply some corrections to my claim, sorry.

Steffen Nurpmeso wrote in
<20200511173946._vy_n%stef...@sdaoden.eu>:
  ...
 |Also, if i say "? set mailcap-disable" and then

Actually unnecessary, ~/.mailcap is inspected as a second step.

 |  set pipe-application/pdf='@*=mupdf $MAILX_FILENAME_TEMPORARY'

This should be "?*=++? mupdf $MAILX_FILENAME_TEMPORARY" then.
Important is ? not @ (has been deprecated long ago, hmm), and the
++ to delete the file backing $MAILX_FILENAME_TEMPORARY, otherwise
your $TMPDIR will fill.

Or just use an according entry in ~/.mailcap.
What could really make sense is an environment variable that is
passed to ~/.mailcap tests, so that those know the actual command
(i.e., mimeview or print).  Hmm.

 |mupdf(1) will be spawned even for "print".

Ciao, and greetings to Greece!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Re: [S-mailx] Display HTML messages

2020-05-11 Thread Steffen Nurpmeso
Hello Giannis.

Hm, your address is in "wave-through" -- but now you are
subscribed, and so you got stuck in the queue ...

Giannis-2 wrote in
<20200511152037.s1tsj%giannismicr...@gmail.com>:
 |I readed the chapter 9, https://www.sdaoden.eu/code-nail.html#9,
 |so is it  possible to use chromium  instead of lynx/elinks,  to display \
 |HTML messages?
 |I use "set pipe-text/html='?* lynx -stdin -dump -force_html -display_cha\
 |rset=utf-8'" in .mailrc and it works ok with lynx.

You possibly want to consider to move over and use ~/.mailcap
support (section #36), it can be used by other programs, too.

So the answer should be "yes", but on the other hand we do not
support displaying anything in external programs for normal
message display, you need to use the `mimeview' command for that.
The reason is also that we can potentially display an infinite
number of messages at once, and if you say "print *" in a mailbox
with thousands of HTML messages you could end up with problems.

For example my ~/.mailcap has the following for PDF files:

  application/pdf; /Applications/Preview.app/Contents/MacOS/Preview %s;\
nametemplate = %s.pdf;\
test = [ "${OSTYPE}" = darwin ];\
x-mailx-test-once
  application/pdf;\
infile=%s\;\
  trap "rm -f ${infile}" EXIT\;\
  trap "exit 75" INT QUIT TERM\;\
  mupdf "${infile}";\
nametemplate = %s.pdf;\
test = [ -n "${DISPLAY}" ];\
x-mailx-async; x-mailx-test-once
  application/pdf;\
command -v pdfinfo >/dev/null 2>&1 && pdfinfo %s\;\
  pdftotext -layout %s -;\
nametemplate = %s.pdf;\
copiousoutput

For "print ." this will fall through to the last entry, because of
the "copiousoutput" flag which states this entry embeds nicely
into normal display flow.

For "mimeview ." this will -- on a X11 display -- use mupdf to
display the file:

  #?0!0/NONE#0|:/tmp/AU? mimev
  [-- Message  1 -- 2179 lines, 166727 bytes --]:
  Date: Mon, 11 May 2020 19:26:33 +0200
  To: e...@am.ple
  Subject: test


  [-- #1.1 2165/166339 application/pdf, base64, us-ascii --]
  [-- the-universe-as-quantum-computer.pdf --]
  Run MIME handler for this part? [no]/yes? y

You will be asked for each and every MIME part for which handlers
are installed whether they shall be run or not.

Having said that, maybe it would make sense to offer a special
x-mailx ~/.mailcap flag, maybe x-mailx-force-use or so, to always
use the handler, even if copiousoutput is not also set.
Also, if i say "? set mailcap-disable" and then

  set pipe-application/pdf='@*=mupdf $MAILX_FILENAME_TEMPORARY'

mupdf(1) will be spawned even for "print".

Ciao, and greetings to Greece!

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)