Gnus development mailing list
 help / color / mirror / Atom feed
* View HTML Mail in Browser
@ 2021-02-06 13:39 Felix Natter
  2021-02-06 14:03 ` Andreas Schwab
  2021-02-07 10:23 ` Valtteri Vuorikoski
  0 siblings, 2 replies; 17+ messages in thread
From: Felix Natter @ 2021-02-06 13:39 UTC (permalink / raw)
  To: ding

hello Gnus users,

I would like to view complex HTML mails in Firefox.

I found this (https://www.emacswiki.org/emacs/MimeTypesWithGnus):

(defun my-gnus-summary-view-html-alternative-in-firefox ()
  "Display the HTML part of the current multipart/alternative MIME message
    in mozilla."
  (interactive)
  (save-current-buffer
    (gnus-summary-show-article)
    (set-buffer gnus-article-buffer)
    (let ((file (make-temp-file "html-message-" nil ".html"))
          ;;(handle (nth 3 (assq 1 gnus-article-mime-handle-alist))))
          (handle (caddr (assq 1 gnus-article-mime-handle-alist))))
      (mm-save-part-to-file handle file)
      (browse-url-firefox-new-tab (concat "file://" file)))))

Note that I changed the (nth 3 to (caddr as mentioned on that wiki page.

Sometimes it generates the .html but does not open the browser, but
often it just shows the headers of the selected article, and does
nothing (at least in *Messages*).

I am using Gnus v5.13 with Emacs 26.3.

Is there a modern best practice for reading non-trivial HTML mails?  I
know about shr, but it often fails.

Thanks and Best Regards,
Felix
--
Felix Natter



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

* Re: View HTML Mail in Browser
  2021-02-06 13:39 View HTML Mail in Browser Felix Natter
@ 2021-02-06 14:03 ` Andreas Schwab
  2021-02-06 21:33   ` Felix Natter
  2021-05-26 14:08   ` Steinar Bang
  2021-02-07 10:23 ` Valtteri Vuorikoski
  1 sibling, 2 replies; 17+ messages in thread
From: Andreas Schwab @ 2021-02-06 14:03 UTC (permalink / raw)
  To: Felix Natter; +Cc: ding

On Feb 06 2021, Felix Natter wrote:

> Is there a modern best practice for reading non-trivial HTML mails?  I
> know about shr, but it often fails.

How about K H (gnus-article-browse-html-article)?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


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

* Re: View HTML Mail in Browser
  2021-02-06 14:03 ` Andreas Schwab
@ 2021-02-06 21:33   ` Felix Natter
  2021-02-06 21:54     ` Adam Sjøgren
  2021-02-06 23:19     ` Eric Abrahamsen
  2021-05-26 14:08   ` Steinar Bang
  1 sibling, 2 replies; 17+ messages in thread
From: Felix Natter @ 2021-02-06 21:33 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: ding

hi Andreas,

thanks for the reply.

Andreas Schwab <schwab@linux-m68k.org> writes:
> On Feb 06 2021, Felix Natter wrote:
>
>> Is there a modern best practice for reading non-trivial HTML mails?  I
>> know about shr, but it often fails.
>
> How about K H (gnus-article-browse-html-article)?

--------
View "text/html" parts of the current article with a WWW browser.
Inline images embedded in a message using the cid scheme, as they are
generally considered to be safe, will be processed properly.
The message header is added to the beginning of every html part unless
the prefix argument ARG is given.

If you always want to display HTML parts in the browser, set
‘mm-text-html-renderer’ to nil.
--------

Setting (setq mm-text-html-renderer nil) works, but it will open *all*
mails in the browser.

So I tried with a local variable:

--------
(defun my-gnus-article-browse-html-article ()
  ""
  (interactive)
  (let ((mm-text-html-renderer nil))
    (gnus-article-browse-html-article)))
--------

-> this blocks ("waiting for external displayer to die...")

Next I tried:

--------
(add-to-list 'mm-text-html-renderer-alist
             '(ff . browse-url-firefox-new-tab))
(defun my-gnus-article-browse-html-article ()
  ""
  (interactive)
  (let ((mm-text-html-renderer 'ff))
    (gnus-article-browse-html-article)))
--------

-> this gives an error like
shell-command-to-string: Wrong type argument: characterp, #<buffer
*mm*-455001>

Finally I tried to create a new thread to get around the blocking
problem:

--------
(defun my-gnus-article-browse-html-article ()
  ""
  (interactive)
  (make-thread
   (lambda ()
     (let ((mm-text-html-renderer nil))
       (gnus-article-browse-html-article)))))
--------

This works better than the first solution, but it doesn't work perfectly
(blocks for some seconds, saves the mail multiple times and opens it
multiple times in the browser).

Any idea?

Thanks and Best Regards,
-- 
Felix Natter



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

* Re: View HTML Mail in Browser
  2021-02-06 21:33   ` Felix Natter
@ 2021-02-06 21:54     ` Adam Sjøgren
  2021-02-07  9:36       ` Felix Natter
  2021-02-06 23:19     ` Eric Abrahamsen
  1 sibling, 1 reply; 17+ messages in thread
From: Adam Sjøgren @ 2021-02-06 21:54 UTC (permalink / raw)
  To: ding

Felix writes:

>> How about K H (gnus-article-browse-html-article)?

> --------
> View "text/html" parts of the current article with a WWW browser.
> Inline images embedded in a message using the cid scheme, as they are
> generally considered to be safe, will be processed properly.
> The message header is added to the beginning of every html part unless
> the prefix argument ARG is given.
>
> If you always want to display HTML parts in the browser, set
> ‘mm-text-html-renderer’ to nil.
> --------
>
> Setting (setq mm-text-html-renderer nil) works, but it will open *all*
> mails in the browser.
>
> So I tried with a local variable:

...

> Next I tried:

...

> Finally I tried to create a new thread to get around the blocking
> problem:

What is problem are you trying to solve?

If an email doesn't render well enough in Gnus, I press the keys K H and
this one email is displayed in Firefox instead.

It sounds like you don't want _all_ emails to open in the browser - so
doesn't pressing K H on just the ones you want to see in the browser
work?


  Best regards,

    Adam

-- 
 "Somebody said from the Bible he'd quote                   Adam Sjøgren
  There was dust on the man in the long black coat"    asjo@koldfront.dk



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

* Re: View HTML Mail in Browser
  2021-02-06 21:33   ` Felix Natter
  2021-02-06 21:54     ` Adam Sjøgren
@ 2021-02-06 23:19     ` Eric Abrahamsen
  1 sibling, 0 replies; 17+ messages in thread
From: Eric Abrahamsen @ 2021-02-06 23:19 UTC (permalink / raw)
  To: Felix Natter; +Cc: Andreas Schwab, ding

Felix Natter <fnatter@gmx.net> writes:

> hi Andreas,
>
> thanks for the reply.
>
> Andreas Schwab <schwab@linux-m68k.org> writes:
>> On Feb 06 2021, Felix Natter wrote:
>>
>>> Is there a modern best practice for reading non-trivial HTML mails?  I
>>> know about shr, but it often fails.
>>
>> How about K H (gnus-article-browse-html-article)?
>
> --------
> View "text/html" parts of the current article with a WWW browser.
> Inline images embedded in a message using the cid scheme, as they are
> generally considered to be safe, will be processed properly.
> The message header is added to the beginning of every html part unless
> the prefix argument ARG is given.
>
> If you always want to display HTML parts in the browser, set
> ‘mm-text-html-renderer’ to nil.
> --------
>
> Setting (setq mm-text-html-renderer nil) works, but it will open *all*
> mails in the browser.
>
> So I tried with a local variable:
>
> --------
> (defun my-gnus-article-browse-html-article ()
>   ""
>   (interactive)
>   (let ((mm-text-html-renderer nil))
>     (gnus-article-browse-html-article)))
> --------
>
> -> this blocks ("waiting for external displayer to die...")
>
> Next I tried:
>
> --------
> (add-to-list 'mm-text-html-renderer-alist
>              '(ff . browse-url-firefox-new-tab))
> (defun my-gnus-article-browse-html-article ()
>   ""
>   (interactive)
>   (let ((mm-text-html-renderer 'ff))
>     (gnus-article-browse-html-article)))
> --------
>
> -> this gives an error like
> shell-command-to-string: Wrong type argument: characterp, #<buffer
> *mm*-455001>
>
> Finally I tried to create a new thread to get around the blocking
> problem:
>
> --------
> (defun my-gnus-article-browse-html-article ()
>   ""
>   (interactive)
>   (make-thread
>    (lambda ()
>      (let ((mm-text-html-renderer nil))
>        (gnus-article-browse-html-article)))))
> --------
>
> This works better than the first solution, but it doesn't work perfectly
> (blocks for some seconds, saves the mail multiple times and opens it
> multiple times in the browser).
>
> Any idea?

I've never had to do anything but:

(setq browse-url-browser-function #'browse-url-firefox)

And even there I probably could have left it at its default value of
`browse-url-default-browser', which looks like it would have found
firefox anyway.

You can look at the values of `browse-url-(default-)handlers', there
might be something funny happening there.

Eric


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

* Re: View HTML Mail in Browser
  2021-02-06 21:54     ` Adam Sjøgren
@ 2021-02-07  9:36       ` Felix Natter
  2021-02-07 12:50         ` Adam Sjøgren
  2021-02-08 11:05         ` Eric S Fraga
  0 siblings, 2 replies; 17+ messages in thread
From: Felix Natter @ 2021-02-07  9:36 UTC (permalink / raw)
  To: Adam Sjøgren; +Cc: ding

Adam Sjøgren <asjo@koldfront.dk> writes:

> Felix writes:
>
>>> How about K H (gnus-article-browse-html-article)?
>
>> --------
>> View "text/html" parts of the current article with a WWW browser.
>> Inline images embedded in a message using the cid scheme, as they are
>> generally considered to be safe, will be processed properly.
>> The message header is added to the beginning of every html part unless
>> the prefix argument ARG is given.
>>
>> If you always want to display HTML parts in the browser, set
>> ‘mm-text-html-renderer’ to nil.
>> --------
>>
>> Setting (setq mm-text-html-renderer nil) works, but it will open *all*
>> mails in the browser.
>>
>> So I tried with a local variable:
>
> ...
>
>> Next I tried:
>
> ...
>
>> Finally I tried to create a new thread to get around the blocking
>> problem:

hello Adam,

> What is problem are you trying to solve?

I would like to open mails using w3m by default,
and if I hit K H I would like to open it in the browser:

(setq mm-text-html-renderer 'w3m
      w3m-coding-system 'utf-8
      w3m-file-coding-system 'utf-8
      w3m-file-name-coding-system 'utf-8
      w3m-input-coding-system 'utf-8
      w3m-output-coding-system 'utf-8
      w3m-terminal-coding-system 'utf-8
      w3m-toggle-inline-images t 
      w3m-default-display-inline-images t)

> If an email doesn't render well enough in Gnus, I press the keys K H and
> this one email is displayed in Firefox instead.
>
> It sounds like you don't want _all_ emails to open in the browser - so
> doesn't pressing K H on just the ones you want to see in the browser
> work?

There must be some configuration that prevents this for me: If I have:

(setq mm-text-html-renderer nil)

Then whenever I open an (html) mail, it is automatically opened in the
browser. I could not find any other relevant setting in ~/.gnus.el and
~/.emacs.el.

Emacs version: GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+
      Version 3.24.5) I built this myself due to an issue with 26.1
      in Debian buster.
Gnus version: Gnus v5.13

Shall I update to Emacs 27.1? Would there be any Gnus compatibility
issues that I need to watch out for?

Thanks and Best Regards,
-- 
Felix Natter



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

* Re: View HTML Mail in Browser
  2021-02-06 13:39 View HTML Mail in Browser Felix Natter
  2021-02-06 14:03 ` Andreas Schwab
@ 2021-02-07 10:23 ` Valtteri Vuorikoski
  2021-02-09 22:02   ` Adam Sjøgren
  1 sibling, 1 reply; 17+ messages in thread
From: Valtteri Vuorikoski @ 2021-02-07 10:23 UTC (permalink / raw)
  To: ding

Felix Natter <fnatter@gmx.net> writes:

> Is there a modern best practice for reading non-trivial HTML mails?  I
> know about shr, but it often fails.

I don't know about best practice, but I use Thunderbird to open
problematic mail. This is nicer than a browser since external images and
Javascript are disabled by default, and attachments can also be accessed
in the GUI application.

First, a shell script called thunderbird-open-file (I also use this with
the file indexer Recoll for opening mail files so it has some extra
functionality):

#!/bin/bash

if [[ -z "$1" ]] ; then
  echo "usage: thunderbird-open-file <file>" >&2
  exit 1
fi

umask 077
f=/tmp/tb-open-$$.eml
if [[ "$1" == "-" ]] ; then
  rm -f "$f"
  cat > "$f"
else
  cp --remove-destination "$1" $f
fi
( thunderbird -file $f ; rm -f $f ) < /dev/null > /dev/null 2>&1 &


Next, the gnus integration (copypasta from gnus-summary-pipe-to-muttprint):

(defun gnus-summary-pipe-to-thunderbird (&optional command)
  "Pipe this article to Thunderbird with a helper script."
  (unless (stringp command)
    (setq command (expand-file-name "~/bin/thunderbird-open-file -")))
  (let ((gnus-summary-pipe-output-default-command
         gnus-summary-pipe-output-default-command))
    (gnus-summary-save-in-pipe command t)))

(defun gnus-summary-thunderbird (&optional arg)
  "Show the current article using Thunderbird."
  (interactive "P")
  (require 'gnus-art)
  (let ((gnus-default-article-saver 'gnus-summary-pipe-to-thunderbird))
    (gnus-summary-save-article arg t)))

(define-key gnus-summary-mode-map (kbd "O t") 'gnus-summary-thunderbird)
(define-key gnus-article-mode-map (kbd "O t") 'gnus-summary-thunderbird)


Tip if you end up rolling your own instead: the file name passed to
"thunderbird -file" must end with ".eml". Otherwise it tries to be smart
and falls over. 

 -Valtteri



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

* Re: View HTML Mail in Browser
  2021-02-07  9:36       ` Felix Natter
@ 2021-02-07 12:50         ` Adam Sjøgren
  2021-02-13 11:34           ` Felix Natter
  2021-02-08 11:05         ` Eric S Fraga
  1 sibling, 1 reply; 17+ messages in thread
From: Adam Sjøgren @ 2021-02-07 12:50 UTC (permalink / raw)
  To: ding

Felix writes:

>> What is problem are you trying to solve?

> I would like to open mails using w3m by default,
> and if I hit K H I would like to open it in the browser:

Ah, ok, I missed the w3m part (shr works better for me), and then got
confused about what wasn't working for you, sorry!

> There must be some configuration that prevents this for me:

Yes, that is very odd, it works "out of the box" for me.

Oh, wait, how do you start Emacs? I have a vague memory that there might
still be parts that check for X once, and then never rechecks, meaning
that you get different behaviour if you start a Emacs as a daemon in the
background without X, or from an Emacs that starts up with an X window.

Could that be it?

I.e. to check, stop Emacs completely, start Emacs in X, read an HTML
email, press K H?

If not, my next step would be to M-x edebug-defun on
gnus-article-browse-html-article and gnus-article-browse-html-parts and
then step through them and see what happens.

It looks like the latter ends up calling browse-url-of-file, so you
might want to experiment with that one, to see if it opens Firefox when
called on a file - if not, then that's a clue.

E.g. if you in a *scratch* buffer evaluate:

  (browse-url-of-file "test.html")

do you then get a Firefox window trying to open test.html?

If not, is your value of:

,----[ C-h v browse-url-browser-function RET ]
| browse-url-browser-function is a variable defined in ‘browse-url.el’.
| Its value is ‘browse-url-firefox’
| Original value was 
| ‘browse-url-default-browser’
| 
|   This variable may be risky if used as a file-local variable.
|   You can customize this variable.
|   This variable was introduced, or its default value was changed, in
|   version 24.1 of Emacs.
|   Probably introduced at or before Emacs version 20.1.
| 
| Documentation:
| Function to display the current buffer in a WWW browser.
| This is used by the ‘browse-url-at-point’, ‘browse-url-at-mouse’, and
| ‘browse-url-of-file’ commands.
| 
| Also see ‘browse-url-secondary-browser-function’ and
| ‘browse-url-handlers’.
`----

?

> Shall I update to Emacs 27.1? Would there be any Gnus compatibility
> issues that I need to watch out for?

I don't think this functionality has changed a lot recently.


  Best regards,

    Adam

-- 
 "heksaeder  -> heksaeder   -> heksæder"                    Adam Sjøgren
                                                       asjo@koldfront.dk



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

* Re: View HTML Mail in Browser
  2021-02-07  9:36       ` Felix Natter
  2021-02-07 12:50         ` Adam Sjøgren
@ 2021-02-08 11:05         ` Eric S Fraga
  2021-02-08 11:44           ` Emanuel Berg
  1 sibling, 1 reply; 17+ messages in thread
From: Eric S Fraga @ 2021-02-08 11:05 UTC (permalink / raw)
  To: ding

On Sunday,  7 Feb 2021 at 10:36, Felix Natter wrote:
> I would like to open mails using w3m by default,
> and if I hit K H I would like to open it in the browser:

I use eww for HTML emails; eww has the & key bound to open up the
current URL in an external browser so easy to pop-up Firefox (or
whatever) if the HTML results to be too complicated for eww.

-- 
Eric S Fraga via Emacs 28.0.50 & org 9.4.4 on Debian bullseye/sid



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

* Re: View HTML Mail in Browser
  2021-02-08 11:05         ` Eric S Fraga
@ 2021-02-08 11:44           ` Emanuel Berg
  2021-02-08 11:58             ` Eric S Fraga
  2021-02-08 12:12             ` Andreas Schwab
  0 siblings, 2 replies; 17+ messages in thread
From: Emanuel Berg @ 2021-02-08 11:44 UTC (permalink / raw)
  To: ding

Eric S Fraga wrote:

>> I would like to open mails using w3m by default, and if
>> I hit K H I would like to open it in the browser:
>
> I use eww for HTML emails; eww has the & key bound to open
> up the current URL in an external browser so easy to pop-up
> Firefox (or whatever) if the HTML results to be too
> complicated for eww.

I do this:

  (setq mm-discouraged-alternatives '("text/html" "text/richtext"))
  (setq mm-text-html-renderer       'w3m)

Here, "w3m" isn't w3m (for that, use `w3m-standalone'), "w3m"
is Emacs-w3m.

Ah, might as well yank the list:

 ‘shr’: use the built-in Gnus HTML renderer;
 ‘gnus-w3m’: use Gnus renderer based on w3m;
 ‘w3m’: use emacs-w3m;
 ‘w3m-standalone’: use plain w3m;
 ‘links’: use links;
 ‘lynx’: use lynx;
 ‘html2text’: use html2text.

Despite being a happy Emacs-w3m user and after spending half
a lifetime configuring [1] it I could never change,
practically speaking but ... why isn't eww in the list?

Also, that order ... is it the recommended pecking order
according to the developers? If not, alpha sort always work:

 ‘gnus-w3m’: use Gnus renderer based on w3m
 ‘html2text’: use html2text
 ‘links’: use links
 ‘lynx’: use lynx
 ‘shr’: use the built-in Gnus HTML renderer
 ‘w3m-standalone’: use plain w3m
 ‘w3m’: use emacs-w3m

[1] https://dataswamp.org/~incal/emacs-init/w3m/

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal



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

* Re: View HTML Mail in Browser
  2021-02-08 11:44           ` Emanuel Berg
@ 2021-02-08 11:58             ` Eric S Fraga
  2021-02-08 12:12             ` Andreas Schwab
  1 sibling, 0 replies; 17+ messages in thread
From: Eric S Fraga @ 2021-02-08 11:58 UTC (permalink / raw)
  To: ding

On Monday,  8 Feb 2021 at 12:44, Emanuel Berg wrote:
>   (setq mm-text-html-renderer       'w3m)

[...]

> Despite being a happy Emacs-w3m user and after spending half
> a lifetime configuring [1] it I could never change,
> practically speaking but ... why isn't eww in the list?

Actually, I thought I was using eww but I actually have
mm-text-html-renderer set to 'gnus-article-html which comes from
gnus-html.el.  gnus-article-html uses w3m.

So, please ignore my previous post...  apologies for the noise.  I got
confused with HTML email display and following links in emails, the
latter using eww.

-- 
Eric S Fraga via Emacs 28.0.50 & org 9.4.4 on Debian bullseye/sid



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

* Re: View HTML Mail in Browser
  2021-02-08 11:44           ` Emanuel Berg
  2021-02-08 11:58             ` Eric S Fraga
@ 2021-02-08 12:12             ` Andreas Schwab
  2021-02-08 15:06               ` Emanuel Berg
  1 sibling, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2021-02-08 12:12 UTC (permalink / raw)
  To: ding

On Feb 08 2021, Emanuel Berg wrote:

> practically speaking but ... why isn't eww in the list?

It's shr, effectively.  eww is just a frontend to the renderer.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


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

* Re: View HTML Mail in Browser
  2021-02-08 12:12             ` Andreas Schwab
@ 2021-02-08 15:06               ` Emanuel Berg
  0 siblings, 0 replies; 17+ messages in thread
From: Emanuel Berg @ 2021-02-08 15:06 UTC (permalink / raw)
  To: ding

Andreas Schwab wrote:

>> practically speaking but ... why isn't eww in the list?
>
> It's shr, effectively. eww is just a frontend to
> the renderer.

Got it, thanks.

Noise is on the house :P

PS. "just a frontend" tho, to be a mere interface it seems
    rather involved :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal



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

* Re: View HTML Mail in Browser
  2021-02-07 10:23 ` Valtteri Vuorikoski
@ 2021-02-09 22:02   ` Adam Sjøgren
  0 siblings, 0 replies; 17+ messages in thread
From: Adam Sjøgren @ 2021-02-09 22:02 UTC (permalink / raw)
  To: ding

Valtteri writes:

> I don't know about best practice, but I use Thunderbird to open
> problematic mail. This is nicer than a browser since external images and
> Javascript are disabled by default, and attachments can also be accessed
> in the GUI application.

  [...]

> Tip if you end up rolling your own instead: the file name passed to
> "thunderbird -file" must end with ".eml". Otherwise it tries to be smart
> and falls over. 

Whoa, I didn't know Thunderbird did this, nice trick!

Gnus should have a K T for this, or something. Ok, K T is taken, but
some other key combo, maybe K G?


  Best regards,

    Adam

-- 
 "Le poulet génial est un nom de code pour le               Adam Sjøgren
  matériel ASCII dessinant sur le frontpage."          asjo@koldfront.dk



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

* Re: View HTML Mail in Browser
  2021-02-07 12:50         ` Adam Sjøgren
@ 2021-02-13 11:34           ` Felix Natter
  2021-02-13 17:30             ` Adam Sjøgren
  0 siblings, 1 reply; 17+ messages in thread
From: Felix Natter @ 2021-02-13 11:34 UTC (permalink / raw)
  To: Adam Sjøgren; +Cc: ding

hello Adam,

Adam Sjøgren <asjo@koldfront.dk> writes:
> Felix writes:
>
>>> What is problem are you trying to solve?
>
>> I would like to open mails using w3m by default,
>> and if I hit K H I would like to open it in the browser:
>
> Ah, ok, I missed the w3m part (shr works better for me), and then got
> confused about what wasn't working for you, sorry!

no problem.

>> There must be some configuration that prevents this for me:
>
> Yes, that is very odd, it works "out of the box" for me.
>
> Oh, wait, how do you start Emacs? I have a vague memory that there might
> still be parts that check for X once, and then never rechecks, meaning
> that you get different behaviour if you start a Emacs as a daemon in the
> background without X, or from an Emacs that starts up with an X window.
>
> Could that be it?

No, I don't do this.

> I.e. to check, stop Emacs completely, start Emacs in X, read an HTML
> email, press K H?

This is what I'm doing.

> If not, my next step would be to M-x edebug-defun on
> gnus-article-browse-html-article and gnus-article-browse-html-parts and
> then step through them and see what happens.
>
> It looks like the latter ends up calling browse-url-of-file, so you
> might want to experiment with that one, to see if it opens Firefox when
> called on a file - if not, then that's a clue.
>
> E.g. if you in a *scratch* buffer evaluate:
>
>   (browse-url-of-file "test.html")

That didn't open anything in the browser.

>
> do you then get a Firefox window trying to open test.html?
>
> If not, is your value of:

Jackpot! I had

(defun browse-url-firefox-new-tab (url &optional new-window)
       "Open URL in a new tab in Firefox."
       (interactive (browse-url-interactive-arg "URL: "))
       (let ((cmd (shell-command-to-string
                   (concat "/usr/bin/firefox -remote -client -a any 'openURL("
                           url ",new-tab)'"))))
         (unless (string= "" cmd)
           (message "Starting Firefox...")
           (start-process (concat "firefox " url) nil "/usr/bin/firefox" url)
           (message "Starting Firefox...done"))))
(setq browse-url-browser-function (quote browse-url-firefox-new-tab))

in my ~/.emacs.el.

once I deactivated this:
  (setq browse-url-browser-function (quote browse-url-firefox))

with this in my .gnus.el:
  (setq mm-text-html-renderer 'shr)

it now renders using shr by default, and when I press K H it renders in
FF (in a new tab) :-)

Many Thanks! Best Regards,
-- 
Felix Natter


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

* Re: View HTML Mail in Browser
  2021-02-13 11:34           ` Felix Natter
@ 2021-02-13 17:30             ` Adam Sjøgren
  0 siblings, 0 replies; 17+ messages in thread
From: Adam Sjøgren @ 2021-02-13 17:30 UTC (permalink / raw)
  To: ding

Felix writes:

>> If not, is your value of:
>
> Jackpot! I had
>
> (defun browse-url-firefox-new-tab (url &optional new-window)

[...]

> in my ~/.emacs.el.
>
> once I deactivated this:
>   (setq browse-url-browser-function (quote browse-url-firefox))
>
> with this in my .gnus.el:
>   (setq mm-text-html-renderer 'shr)
>
> it now renders using shr by default, and when I press K H it renders in
> FF (in a new tab) :-)

The curse of old customizations strikes again! Happy you found the
solution :-)


  Best regards,

    Adam

-- 
 "Q: Are you happy?                                         Adam Sjøgren
  A: Yes. As an ashtray maybe."                        asjo@koldfront.dk



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

* Re: View HTML Mail in Browser
  2021-02-06 14:03 ` Andreas Schwab
  2021-02-06 21:33   ` Felix Natter
@ 2021-05-26 14:08   ` Steinar Bang
  1 sibling, 0 replies; 17+ messages in thread
From: Steinar Bang @ 2021-05-26 14:08 UTC (permalink / raw)
  To: ding

>>>>> Andreas Schwab <schwab@linux-m68k.org>:

> On Feb 06 2021, Felix Natter wrote:
>> Is there a modern best practice for reading non-trivial HTML mails?  I
>> know about shr, but it often fails.

> How about K H (gnus-article-browse-html-article)?

Hah! I wish I had known about that one yesterday!

HP sent me a confirmation key to get a postage paid label to return a
spent laser printer cartridge.

And Gnus was unable to render that HTML and I was unable to find the
confirmation key in the HTML source.

But 'K H' would have worked (it worked today but too late).

Ah well! Next time!



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

end of thread, other threads:[~2021-05-26 21:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-06 13:39 View HTML Mail in Browser Felix Natter
2021-02-06 14:03 ` Andreas Schwab
2021-02-06 21:33   ` Felix Natter
2021-02-06 21:54     ` Adam Sjøgren
2021-02-07  9:36       ` Felix Natter
2021-02-07 12:50         ` Adam Sjøgren
2021-02-13 11:34           ` Felix Natter
2021-02-13 17:30             ` Adam Sjøgren
2021-02-08 11:05         ` Eric S Fraga
2021-02-08 11:44           ` Emanuel Berg
2021-02-08 11:58             ` Eric S Fraga
2021-02-08 12:12             ` Andreas Schwab
2021-02-08 15:06               ` Emanuel Berg
2021-02-06 23:19     ` Eric Abrahamsen
2021-05-26 14:08   ` Steinar Bang
2021-02-07 10:23 ` Valtteri Vuorikoski
2021-02-09 22:02   ` Adam Sjøgren

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 NNTP newsgroup(s).