unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* viewing text/html (inline or otherwise)
@ 2010-02-09 10:28 Alex Ghitza
  2010-02-10  0:22 ` Carl Worth
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Ghitza @ 2010-02-09 10:28 UTC (permalink / raw)
  To: notmuch


Dear Notmuch folks,

I've been using notmuch exclusively (or almost, see below) for the past
couple of months and it is absolutely fabulous!  It also keeps getting
better for me, due for instance to the improved speed from the xapian
bug #250 being fixed, and Jesse and Jamie's code for setting Fcc (which
is working like a charm for me).

There were still two typical occasions when I needed to resort to
logging into Gmail: (a) to look at attachments and (b) to read html
mail.  Tonight, after some searching, I managed to get my emacs to do
(a), and it would be really sweet if I could also do (b) from notmuch in
emacs.  It's such a basic thing that I'm sure everybody else has it
figured out; in fact, I resisted the temptation to be lazy and ask about
this for quite some time, but nothing that I tried got me very far.  (To
be specific, my latest attempt involved w3m, and now when I press 'v'
within a message that has a text/html part, I see "Rendering... done"
followed by "Fontifying... done", but then nothing.)

Ideally, I'd like to be able to see what's hidden behind the 
"Non-text part: text/html", and if it could happen inline that would be
great.  I would also entertain the idea of opening an external browser
window, if that's the way this has to go.

Back in the days when I was using mutt, this could be done by adding
something like:

  in .muttrc:
  auto_view text/html

  in .mailcap:
  text/html; lynx -dump %s ; copiousoutput ; nametemplate=%s.html

Is something like this possible in notmuch+emacs?  (The alternative is
that I get procmail to send all html mail back to sender with a request
to resend as plain text, but most of the culprits won't know what I'm
talking about.)


Best,
Alex

-- 
Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne
-- Australia -- http://www.ms.unimelb.edu.au/~aghitza/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: viewing text/html (inline or otherwise)
  2010-02-09 10:28 viewing text/html (inline or otherwise) Alex Ghitza
@ 2010-02-10  0:22 ` Carl Worth
  2010-02-10  0:43   ` Alexander Botero-Lowry
  2010-02-10  6:10   ` Keith Packard
  0 siblings, 2 replies; 6+ messages in thread
From: Carl Worth @ 2010-02-10  0:22 UTC (permalink / raw)
  To: Alex Ghitza, notmuch

[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]

On Tue, 09 Feb 2010 21:28:25 +1100, Alex Ghitza <aghitza@gmail.com> wrote:
> Ideally, I'd like to be able to see what's hidden behind the 
> "Non-text part: text/html", and if it could happen inline that would be
> great.  I would also entertain the idea of opening an external browser
> window, if that's the way this has to go.

We actually had some support for inline viewing of HTML message parts
for a while. I reverted the code only because it was slowing down
rendering of non-HTML messages. And I did that with the expectation that
the code would appear again shortly with the obvious optimization to not
do any extra work for non-HTML messages.

I know that Keith is using a little script he wrote so that he can hit
'|' on a message and pipe it to his script. The script then uses a
utility, (munpack?) to extract all the various MIME parts to a temporary
directory and then run a web broswer on that directory. Perhaps Keith
would be so kind as to share that script with the community here.

What I'm doing write now is using 'V' to view the raw message and then
running eval-expression (by typing M-:) and then using:

	(mm-display-parts (mm-dissect-buffer))

That isn't ideal because it leaves a bunch of the raw message around,
and leaves a buffer open with a modified version of a mail file in the
mailstore.

I'd definitely like a correct solution. Emacs definitely has no shortage
of already-existing code to parse and render HTML, (even with inline
images, etc.). We just need to find and hook things up properly.

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: viewing text/html (inline or otherwise)
  2010-02-10  0:22 ` Carl Worth
@ 2010-02-10  0:43   ` Alexander Botero-Lowry
  2010-02-10  6:40     ` Alex Ghitza
  2010-02-10  8:14     ` Sebastian Spaeth
  2010-02-10  6:10   ` Keith Packard
  1 sibling, 2 replies; 6+ messages in thread
From: Alexander Botero-Lowry @ 2010-02-10  0:43 UTC (permalink / raw)
  To: Carl Worth, Alex Ghitza, notmuch

On Tue, 09 Feb 2010 16:22:56 -0800, Carl Worth <cworth@cworth.org> wrote:
> On Tue, 09 Feb 2010 21:28:25 +1100, Alex Ghitza <aghitza@gmail.com> wrote:
> > Ideally, I'd like to be able to see what's hidden behind the 
> > "Non-text part: text/html", and if it could happen inline that would be
> > great.  I would also entertain the idea of opening an external browser
> > window, if that's the way this has to go.
> 
> We actually had some support for inline viewing of HTML message parts
> for a while. I reverted the code only because it was slowing down
> rendering of non-HTML messages. And I did that with the expectation that
> the code would appear again shortly with the obvious optimization to not
> do any extra work for non-HTML messages.
EBUSY...

I'll get around to it, I continue to run ancient notmuch with my patch
still in place though because I find it basically unuseable without it,
so I hope to get some free time to pull the change back up and add the
optimization (which is to check the type of the mime part before trying
to do an mm-display-parts on it, so that you save the time of the
dissection if it's not needed).

alex

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: viewing text/html (inline or otherwise)
  2010-02-10  0:22 ` Carl Worth
  2010-02-10  0:43   ` Alexander Botero-Lowry
@ 2010-02-10  6:10   ` Keith Packard
  1 sibling, 0 replies; 6+ messages in thread
From: Keith Packard @ 2010-02-10  6:10 UTC (permalink / raw)
  To: Carl Worth, Alex Ghitza, notmuch

[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]

On Tue, 09 Feb 2010 16:22:56 -0800, Carl Worth <cworth@cworth.org> wrote:

> I know that Keith is using a little script he wrote so that he can hit
> '|' on a message and pipe it to his script. The script then uses a
> utility, (munpack?) to extract all the various MIME parts to a temporary
> directory and then run a web broswer on that directory. Perhaps Keith
> would be so kind as to share that script with the community here.

It's not much of a script, I call it 'view-html'

#!/bin/sh
dir=`mktemp -d`
trap "rm -r $dir" 0
cat "$@" > "$dir"/msg
if munpack -C "$dir" -t < "$dir"/msg 2>&1 | grep 'Did not find'; then
    sed -n '/[Hh][Tt][Mm][Ll]/,$p' "$dir"/msg > $dir/part1.html
    rm "$dir"/msg
fi
for i in "$dir"/part*; do
    if grep -q -i -e '<html>' -e 'text/html' "$i"; then
	iceweasel "$i" &
	sleep 3
	exit 0
    fi
done

Note that if iceweasel isn't already running, it seems to shut down when
the script exits. I don't know why.

-- 
keith.packard@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: viewing text/html (inline or otherwise)
  2010-02-10  0:43   ` Alexander Botero-Lowry
@ 2010-02-10  6:40     ` Alex Ghitza
  2010-02-10  8:14     ` Sebastian Spaeth
  1 sibling, 0 replies; 6+ messages in thread
From: Alex Ghitza @ 2010-02-10  6:40 UTC (permalink / raw)
  To: Alexander Botero-Lowry, notmuch

On Tue, 09 Feb 2010 16:43:20 -0800, Alexander Botero-Lowry <alex.boterolowry@gmail.com> wrote:
> 
> I'll get around to it, I continue to run ancient notmuch with my patch
> still in place though because I find it basically unuseable without it,
> so I hope to get some free time to pull the change back up and add the
> optimization (which is to check the type of the mime part before trying
> to do an mm-display-parts on it, so that you save the time of the
> dissection if it's not needed).
> 

I have just pulled the latest from git.notmuchmail.org (which includes
your reworked inline-html patch).  So far it seems to be working great.


Thanks!
Alex


-- 
Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne
-- Australia -- http://www.ms.unimelb.edu.au/~aghitza/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: viewing text/html (inline or otherwise)
  2010-02-10  0:43   ` Alexander Botero-Lowry
  2010-02-10  6:40     ` Alex Ghitza
@ 2010-02-10  8:14     ` Sebastian Spaeth
  1 sibling, 0 replies; 6+ messages in thread
From: Sebastian Spaeth @ 2010-02-10  8:14 UTC (permalink / raw)
  To: notmuch

On Tue, 09 Feb 2010 16:43:20 -0800, Alexander Botero-Lowry <alex.boterolowry@gmail.com> wrote:
> > rendering of non-HTML messages. And I did that with the expectation that
> > the code would appear again shortly with the obvious optimization to not
> > do any extra work for non-HTML messages.
> EBUSY...
> 
> I'll get around to it,

HEUREKA; I have just my first blue pill image in notmuch/emacs!
Back to civilization. Now, if we can extend this check to also include
images inline, I will be completely happy. But this is really nice
already. Thanks to those involved.

spaetz

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-10  8:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-09 10:28 viewing text/html (inline or otherwise) Alex Ghitza
2010-02-10  0:22 ` Carl Worth
2010-02-10  0:43   ` Alexander Botero-Lowry
2010-02-10  6:40     ` Alex Ghitza
2010-02-10  8:14     ` Sebastian Spaeth
2010-02-10  6:10   ` Keith Packard

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).