Gnus development mailing list
 help / color / mirror / Atom feed
* Never automatically display HTML in an email
@ 2018-06-01  4:02 Chris Marusich
  2018-06-01  8:00 ` Malcolm Purvis
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Chris Marusich @ 2018-06-01  4:02 UTC (permalink / raw)
  To: ding

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

Hi,

I use Gnus for email.  How can I make Gnus never automatically display
HTML in an email?  I'd also like the option to view the HTML in Gnus if
I want to, but that isn't a hard requirement.

Here's what I've tried so far, with limited success:

* Disable automatic display of HTML (as suggested in (gnus) FAQ 4-6):

    (setq mm-automatic-display '("text/plain"))

  This did not work; sometimes Gnus would still automatically show me
  HTML in email when it appeared in a multipart message.

* Ensure that Gnus does not accidentally render HTML in-line when it
  appears in a multipart/related email (as suggested in (gnus) MIME
  Commands):

    (setq gnus-mime-display-multipart-related-as-mixed t)

  This did not work (even after adding "text/html" to
  mm-discouraged-alternatives); Gnus would still automatically show me
  HTML in email when it appeared in a multipart message.  I also tried
  the variations of this variable
  (gnus-mime-display-multipart-alternative-as-mixed,
  gnus-mime-display-multipart-as-mixed), but the results were the same.

* Ignore HTML entirely:

    (setq gnus-ignored-mime-types '("text/html"))

  This DID work, actually.  However, it's overkill for me, since it
  makes it a little difficult to view the HTML in Gnus or save it for
  viewing in another program.

  In addition, even though this effectively removed HTML parts from some
  emails, I was surprised to discover that for multipart emails, I was
  still able to press the button for the HTML part and view it in Gnus.
  I'm fine with that, since it still meets my requirements, but I'm
  surprised because I expected that Gnus would not even let me view the
  HTML part in this way.  After all, I thought I had told Gnus to
  totally ignore HTML.  Is this the intended behavior?

If anyone has any tips on how to make Gnus never automatically display
HTML in emails, while at the same time giving me the option of
displaying the HTML in Gnus if I want to, that would be really nice!

Thank you,

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Never automatically display HTML in an email
  2018-06-01  4:02 Never automatically display HTML in an email Chris Marusich
@ 2018-06-01  8:00 ` Malcolm Purvis
  2018-06-05  7:27   ` Chris Marusich
  2018-06-01  8:05 ` Andreas Schwab
  2018-06-01 11:56 ` Emanuel Berg
  2 siblings, 1 reply; 15+ messages in thread
From: Malcolm Purvis @ 2018-06-01  8:00 UTC (permalink / raw)
  To: ding

>>>>> "Chris" == Chris Marusich <cmmarusich@gmail.com> writes:

Chris> If anyone has any tips on how to make Gnus never automatically
Chris> display HTML in emails, while at the same time giving me the
Chris> option of displaying the HTML in Gnus if I want to [...]

I use the following settings, which displays the text part of the
message whenever possible, but leaves a button that will display the
HTML if I want:

--8<---------------cut here---------------start------------->8---
(setq
  gnus-buttonized-mime-types '("multipart/alternative" "multipart/signed")
   mm-discouraged-alternatives '("text/html" "image/.*")
   gnus-mime-display-multipart-related-as-mixed t
)
--8<---------------cut here---------------end--------------->8---

Malcolm


-- 
	       Malcolm Purvis <malcolm@purvis.id.au>



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

* Re: Never automatically display HTML in an email
  2018-06-01  4:02 Never automatically display HTML in an email Chris Marusich
  2018-06-01  8:00 ` Malcolm Purvis
@ 2018-06-01  8:05 ` Andreas Schwab
  2018-06-01  9:27   ` Adam Sjøgren
  2018-06-01 11:56 ` Emanuel Berg
  2 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2018-06-01  8:05 UTC (permalink / raw)
  To: Chris Marusich; +Cc: ding

On Mai 31 2018, Chris Marusich <cmmarusich@gmail.com> wrote:

> I use Gnus for email.  How can I make Gnus never automatically display
> HTML in an email?  I'd also like the option to view the HTML in Gnus if
> I want to, but that isn't a hard requirement.

I'm using these settings:

(setq mm-discouraged-alternatives '("text/html" "text/richtext" "text/enriched"
				    "multipart/related" "multipart/mixed"))
(setq mm-inline-override-types '("application/octet-stream" "text/html"))

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] 15+ messages in thread

* Re: Never automatically display HTML in an email
  2018-06-01  8:05 ` Andreas Schwab
@ 2018-06-01  9:27   ` Adam Sjøgren
  0 siblings, 0 replies; 15+ messages in thread
From: Adam Sjøgren @ 2018-06-01  9:27 UTC (permalink / raw)
  To: ding

Andreas writes:

> On Mai 31 2018, Chris Marusich <cmmarusich@gmail.com> wrote:
>
>> I use Gnus for email.  How can I make Gnus never automatically display
>> HTML in an email?  I'd also like the option to view the HTML in Gnus if
>> I want to, but that isn't a hard requirement.
>
> I'm using these settings:
>
> (setq mm-discouraged-alternatives '("text/html" "text/richtext" "text/enriched"
> 				    "multipart/related" "multipart/mixed"))
> (setq mm-inline-override-types '("application/octet-stream" "text/html"))

Instead of mm-inline-override-types I have this:

  (setq mm-automatic-display (remove "text/html" mm-automatic-display))

There are many flavours...


  Best regards,

    Adam

-- 
 "Tom has put all my music into this rectangle."              Adam Sjøgren
                                                         asjo@koldfront.dk




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

* Re: Never automatically display HTML in an email
  2018-06-01  4:02 Never automatically display HTML in an email Chris Marusich
  2018-06-01  8:00 ` Malcolm Purvis
  2018-06-01  8:05 ` Andreas Schwab
@ 2018-06-01 11:56 ` Emanuel Berg
  2 siblings, 0 replies; 15+ messages in thread
From: Emanuel Berg @ 2018-06-01 11:56 UTC (permalink / raw)
  To: ding

Chris Marusich wrote:

> I use Gnus for email. How can I make Gnus
> never automatically display HTML in an email?
> I'd also like the option to view the HTML in
> Gnus if I want to, but that isn't
> a hard requirement.

This is what I have: [1]

;;; HTML and NON-ASCII
(setq gnus-inhibit-images t)
(setq mm-discouraged-alternatives '("text/html" "text/richtext"))
(setq mm-text-html-renderer 'w3m)
;; (setq mm-automatic-display
;;       (cl-remove-if (remove "text/html" mm-automatic-display))

Actually I don't even know if it works any
longer or if everyone just stopped sending HTML
to me?

[1] http://user.it.uu.se/~embe8573/emacs-init/gnus/gnus-my.el

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: Never automatically display HTML in an email
  2018-06-01  8:00 ` Malcolm Purvis
@ 2018-06-05  7:27   ` Chris Marusich
  2018-06-05 15:24     ` Jorge A. Alfaro-Murillo
  2018-06-05 19:01     ` Andreas Schwab
  0 siblings, 2 replies; 15+ messages in thread
From: Chris Marusich @ 2018-06-05  7:27 UTC (permalink / raw)
  To: ding

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

Hi Malcolm, Emanuel, Andreas, and Adam,

Thank you for your replies!  

Malcolm Purvis <malcolm@purvis.id.au> writes:

> I use the following settings, which displays the text part of the
> message whenever possible, but leaves a button that will display the
> HTML if I want:
>
> (setq
>   gnus-buttonized-mime-types '("multipart/alternative" "multipart/signed")
>    mm-discouraged-alternatives '("text/html" "image/.*")
>    gnus-mime-display-multipart-related-as-mixed t
> )

Emanuel Berg <moasen@zoho.com> writes:

> This is what I have: [1]
>
> ;;; HTML and NON-ASCII
> (setq gnus-inhibit-images t)
> (setq mm-discouraged-alternatives '("text/html" "text/richtext"))
> (setq mm-text-html-renderer 'w3m)
> ;; (setq mm-automatic-display
> ;;       (cl-remove-if (remove "text/html" mm-automatic-display))

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

> Instead of mm-inline-override-types I have this:
>
>   (setq mm-automatic-display (remove "text/html" mm-automatic-display))

Unfortunately, I couldn't get these various methods to work, even though
I did try fiddling with them in various ways like suggested above.  In
the end, the only way I found to work around it was to tell Gnus to
ignore HTML entirely, which is OK but a bit heavy-handed.

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

> I'm using these settings:
>
> (setq mm-discouraged-alternatives '("text/html" "text/richtext" "text/enriched"
> 				    "multipart/related" "multipart/mixed"))
> (setq mm-inline-override-types '("application/octet-stream" "text/html"))

This may actually be what I want!  Using mm-inline-override-types like
this seems to suppress the automatic display of HTML, and it also leaves
a button for me to interact with.  Excellent!

This allows me to view the HTML in an external browser by typing "K H"
(gnus-article-browse-html-article), which is quite nice.  However, when
I type RET (gnus-article-press-button), it displays the HTML in-line,
instead of rendering it.  This leads me to three more questions:

* Is mm-inline-override-types supposed to be used like this?  It doesn't
  seem to be mentioned in the manual, so I'm a little concerned it might
  be private or something.

* Is it possible to coax Gnus into displaying the HTML part in-line when
  I invoke gnus-article-press-button, even though I've set
  mm-inline-override-types to treat text/html as an attachment?

* Why might it be that when I invoke gnus-article-browse-html-article,
  the article is opened externally using IceCat rather than internally
  using shm?  The value of mm-text-html-renderer is shr, so I expected
  Gnus to open the HTML part using shr.  I was surprised that it used
  IceCat, but it isn't a big deal, I suppose.

Thank you for all your advice!  It's been very helpful.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Never automatically display HTML in an email
  2018-06-05  7:27   ` Chris Marusich
@ 2018-06-05 15:24     ` Jorge A. Alfaro-Murillo
  2018-06-05 15:33       ` Emanuel Berg
  2018-06-06  4:42       ` Chris Marusich
  2018-06-05 19:01     ` Andreas Schwab
  1 sibling, 2 replies; 15+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2018-06-05 15:24 UTC (permalink / raw)
  To: ding

Chris Marusich writes:

> * Why might it be that when I invoke 
> gnus-article-browse-html-article, 
>   the article is opened externally using IceCat rather than 
>   internally using shm?  The value of mm-text-html-renderer is 
>   shr, so I expected Gnus to open the HTML part using shr.  I 
>   was surprised that it used IceCat, but it isn't a big deal, I 
>   suppose.

I think gnus-article-browse-html-article uses browse-url, you 
might want to change the browse-url-browser-function to something 
like browse-url-w3. IceCat is probably what the function 
browse-url-default-browser thinks is the suitable browser.

Best,
-- 
Jorge.




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

* Re: Never automatically display HTML in an email
  2018-06-05 15:24     ` Jorge A. Alfaro-Murillo
@ 2018-06-05 15:33       ` Emanuel Berg
  2018-06-06  4:42       ` Chris Marusich
  1 sibling, 0 replies; 15+ messages in thread
From: Emanuel Berg @ 2018-06-05 15:33 UTC (permalink / raw)
  To: ding

Don't forget to post here when and how you (the
OP) finally get it to work!

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: Never automatically display HTML in an email
  2018-06-05  7:27   ` Chris Marusich
  2018-06-05 15:24     ` Jorge A. Alfaro-Murillo
@ 2018-06-05 19:01     ` Andreas Schwab
  1 sibling, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2018-06-05 19:01 UTC (permalink / raw)
  To: Chris Marusich; +Cc: ding

On Jun 05 2018, Chris Marusich <cmmarusich@gmail.com> wrote:

> This allows me to view the HTML in an external browser by typing "K H"
> (gnus-article-browse-html-article), which is quite nice.  However, when
> I type RET (gnus-article-press-button), it displays the HTML in-line,
> instead of rendering it.

You can do that with "i" (gnus-article-inline-part).

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] 15+ messages in thread

* Re: Never automatically display HTML in an email
  2018-06-05 15:24     ` Jorge A. Alfaro-Murillo
  2018-06-05 15:33       ` Emanuel Berg
@ 2018-06-06  4:42       ` Chris Marusich
  2018-06-06 16:58         ` Eric Abrahamsen
  1 sibling, 1 reply; 15+ messages in thread
From: Chris Marusich @ 2018-06-06  4:42 UTC (permalink / raw)
  To: Jorge A. Alfaro-Murillo, Emanuel Berg, Andreas Schwab; +Cc: ding

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

Hi Jorge, Emanuel, and Andreas,

Thank you for the replies!

"Jorge A. Alfaro-Murillo" <jorge.alfaro-murillo@yale.edu> writes:

> I think gnus-article-browse-html-article uses browse-url, you might
> want to change the browse-url-browser-function to something like
> browse-url-w3. IceCat is probably what the function
> browse-url-default-browser thinks is the suitable browser.

Yes, that seems to be what's going on.  It makes sense!

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

> On Jun 05 2018, Chris Marusich <cmmarusich@gmail.com> wrote:
>
>> This allows me to view the HTML in an external browser by typing "K H"
>> (gnus-article-browse-html-article), which is quite nice.  However, when
>> I type RET (gnus-article-press-button), it displays the HTML in-line,
>> instead of rendering it.
>
> You can do that with "i" (gnus-article-inline-part).

Perfect!  I missed this somehow.  Thank you for pointing it out to me.

Emanuel Berg <moasen@zoho.com> writes:

> Don't forget to post here when and how you (the
> OP) finally get it to work!

In sum, the configuration I decided to use in the end was the following:

* Put "text/html" in the mm-inline-override-type list.  Since for me it
  was empty to begin with, I just did this:

      (setq mm-inline-override-types '("text/html"))

  This seems to inhibit the automatic display of HTML parts in all email
  I receive, no matter where those HTML parts appear.  Instead of being
  displayed, they show up as attachments.  Note that I put buttons on
  ALL my MIME types to begin with (i.e., I set
  gnus-inhibit-mime-unbuttonizing to t and gnus-buttonized-mime-types to
  nil), so you might also need to make sure buttons are always shown if
  you want to duplicate the configuration I have.

* I also discourage Gnus from displaying HTML alternatives, which makes
  it so that Gnus automatically displays the text/plain alternative when
  the email has text/plain and a text/html alternatives:

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

With the above configuration, the following appears (so far) to be true
for any email I receive that has an HTML part (regardless of whether it
is an alternative part in a multipart/alternative email, or it is the
only part in the email):

* HTML parts are not displayed automatically.  They always show up as a
  button, and I have to manually press the button (by moving point over
  it and typing RET) to view it.  Even when I do that, the displayed
  contents are the raw HTML - it is not rendered.

* I can render the HTML part in-line by pressing "i" while point is on
  the button.

* I can render the HTML part externally by pressing "K H" while point is
  on the button.

This is pretty much exactly how I wanted it to be, since it allows me to
control when Gnus will render the HTML part, and I can prevent Gnus from
rendering it until after I have inspected the HTML to verify that
nothing obviously crazy is going on.  And it's pretty painless.

Thank you!

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Never automatically display HTML in an email
  2018-06-06  4:42       ` Chris Marusich
@ 2018-06-06 16:58         ` Eric Abrahamsen
  2018-06-06 17:37           ` Emanuel Berg
  0 siblings, 1 reply; 15+ messages in thread
From: Eric Abrahamsen @ 2018-06-06 16:58 UTC (permalink / raw)
  To: ding

Chris Marusich <cmmarusich@gmail.com> writes:

> Hi Jorge, Emanuel, and Andreas,
>
> Thank you for the replies!

And thanks for the summary! I stole some config from that (Gnus mime has
always been a black box as far as I'm concerned).

Eric




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

* Re: Never automatically display HTML in an email
  2018-06-06 16:58         ` Eric Abrahamsen
@ 2018-06-06 17:37           ` Emanuel Berg
  2018-06-06 18:06             ` Eric Abrahamsen
  0 siblings, 1 reply; 15+ messages in thread
From: Emanuel Berg @ 2018-06-06 17:37 UTC (permalink / raw)
  To: ding

Eric Abrahamsen wrote:

> And thanks for the summary! I stole some
> config from that (Gnus mime has always been
> a black box as far as I'm concerned).

Question remains why this should be so
complicated, especially since a lot of people
seem to want it. Or is it just the "true
hacker" audience of this newsgroup?

Anyway, perhaps synthetise into a

    (setq gnus-article-down-with-html t)

?

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: Never automatically display HTML in an email
  2018-06-06 17:37           ` Emanuel Berg
@ 2018-06-06 18:06             ` Eric Abrahamsen
  2018-06-06 18:41               ` Emanuel Berg
  0 siblings, 1 reply; 15+ messages in thread
From: Eric Abrahamsen @ 2018-06-06 18:06 UTC (permalink / raw)
  To: ding

Emanuel Berg <moasen@zoho.com> writes:

> Eric Abrahamsen wrote:
>
>> And thanks for the summary! I stole some
>> config from that (Gnus mime has always been
>> a black box as far as I'm concerned).
>
> Question remains why this should be so
> complicated, especially since a lot of people
> seem to want it. Or is it just the "true
> hacker" audience of this newsgroup?
>
> Anyway, perhaps synthetise into a
>
>     (setq gnus-article-down-with-html t)
>
> ?

Beats me, really. Personally, part of it is that I don't work with
mime-types all that often, and keep forgetting the terminology.
The "Using MIME" and "MIME Commands" sections of the Gnus manual get you
part-way there, but then you fall down the rabbit-hole of the separate
"Emacs MIME" manual, and there goes your Thursday night. I eventually
got mad and hit it with a hammer:

(setq mailcap-mime-data
'(("application" (".*" (viewer . "xdg-open %s")))))

But occasionally that still causes errors and complaints about a lack of
a "text/plain" part or something like that, I'm still too annoyed to go
and figure out what's going on. Attempts to "follow the code" result in
near-instant headaches.

Eric




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

* Re: Never automatically display HTML in an email
  2018-06-06 18:06             ` Eric Abrahamsen
@ 2018-06-06 18:41               ` Emanuel Berg
  2018-06-06 18:51                 ` Eric Abrahamsen
  0 siblings, 1 reply; 15+ messages in thread
From: Emanuel Berg @ 2018-06-06 18:41 UTC (permalink / raw)
  To: ding

Eric Abrahamsen wrote:

> The "Using MIME" and "MIME Commands" sections
> of the Gnus manual get you part-way there,
> but then you fall down the rabbit-hole of the
> separate "Emacs MIME" manual, and there goes
> your Thursday night. I eventually got mad and
> hit it with a hammer:
>
> (setq mailcap-mime-data '(("application"
> (".*" (viewer . "xdg-open %s")))))
>
> But occasionally that still causes errors and
> complaints about a lack of a "text/plain"
> part or something like that, I'm still too
> annoyed to go and figure out what's going on.
> Attempts to "follow the code" result in
> near-instant headaches.

Well good work anyway and don't loose any
Thursday nights on my behalf at least :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: Never automatically display HTML in an email
  2018-06-06 18:41               ` Emanuel Berg
@ 2018-06-06 18:51                 ` Eric Abrahamsen
  0 siblings, 0 replies; 15+ messages in thread
From: Eric Abrahamsen @ 2018-06-06 18:51 UTC (permalink / raw)
  To: ding

Emanuel Berg <moasen@zoho.com> writes:

> Eric Abrahamsen wrote:
>
>> The "Using MIME" and "MIME Commands" sections
>> of the Gnus manual get you part-way there,
>> but then you fall down the rabbit-hole of the
>> separate "Emacs MIME" manual, and there goes
>> your Thursday night. I eventually got mad and
>> hit it with a hammer:
>>
>> (setq mailcap-mime-data '(("application"
>> (".*" (viewer . "xdg-open %s")))))
>>
>> But occasionally that still causes errors and
>> complaints about a lack of a "text/plain"
>> part or something like that, I'm still too
>> annoyed to go and figure out what's going on.
>> Attempts to "follow the code" result in
>> near-instant headaches.
>
> Well good work anyway and don't loose any
> Thursday nights on my behalf at least :)

Oh I won't :) But I doubt I'll really ever figure this stuff out.




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

end of thread, other threads:[~2018-06-06 18:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01  4:02 Never automatically display HTML in an email Chris Marusich
2018-06-01  8:00 ` Malcolm Purvis
2018-06-05  7:27   ` Chris Marusich
2018-06-05 15:24     ` Jorge A. Alfaro-Murillo
2018-06-05 15:33       ` Emanuel Berg
2018-06-06  4:42       ` Chris Marusich
2018-06-06 16:58         ` Eric Abrahamsen
2018-06-06 17:37           ` Emanuel Berg
2018-06-06 18:06             ` Eric Abrahamsen
2018-06-06 18:41               ` Emanuel Berg
2018-06-06 18:51                 ` Eric Abrahamsen
2018-06-05 19:01     ` Andreas Schwab
2018-06-01  8:05 ` Andreas Schwab
2018-06-01  9:27   ` Adam Sjøgren
2018-06-01 11:56 ` Emanuel Berg

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).