[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
First of all, if the user option mm-text-html-renderer
defaults
to shr
or gnus-w3m
(i.e., if the function mm-shr
or
gnus-article-html
is available) and you are satisfied with that
function that is Gnus’ built-in HTML renderer, you may not
want to do anything. See (emacs-mime)Display Customization section ‘Display Customization’ in The Emacs MIME Manual. Also See (gnus)HTML section ‘HTML’ in The Gnus Manual.
But if Gnus you use is a bit old and neither the mm-shr
function
nor the gnus-article-html
function is available, or if you’d like
to try emacs-w3m to render HTML articles, this section is just
for you.
You can convert HTML spam mails to be human-readable using emacs-w3m. Of course, it works for HTML ham (non-spam) mails as well, and for both emacs-w3m is probably faster than the default converter. You don’t need to perform any additional operation. It will simply be displayed.
On HTML parts of an article buffer, the w3m-minor-mode
is turned
on and you can use the same main keys as the keys of emacs-w3m, for
instance, <RET> is for visiting a page which a link in the
current position points to. Those keys are defined in the
w3m-minor-mode-command-alist
variable. Keep in mind that some
commands are replaced by others similar to them, for security reasons
(see below).
Add this line to your ‘~/.gnus.el’ file:
(setq mm-text-html-renderer 'w3m) |
Also put the following line if you want to show images inline in article buffers:
(setq mm-inline-text-html-with-images t) |
If you don’t need to use emacs-w3m keys in article buffers, add the following line too:
(setq mm-inline-text-html-with-w3m-keymap nil) |
The above description about spam and ham is not for kidding, it’s just
here to get your attention. Some HTML mails might contain a nasty trick
used by spammers, using the ‘<img>’ tag which is far more evil than
the ‘Click Here!’ button. It is most likely intended to check
whether the ominous spam mail has reached your eyes or not, in which
case the spammer knows for sure that your email address is valid. It is
done by embedding an identifier string into a URL that you might
automatically retrieve when displaying the image. If the
mm-w3m-safe-url-regexp
variable has not been changed from the
default value, Gnus will never connect to the spammer’s site
arbitrarily.
You can display images inline in an article buffer if you set
mm-inline-text-html-with-images
to t
, can’t you? No, not
exactly: you’re still being protected. If you don’t care about leaking
information (i.e. the fact that your mail address is reachable), set the
mm-w3m-safe-url-regexp
variable to nil
. The default value
for mm-w3m-safe-url-regexp
is ‘"\\`cid:"’ which means we
consider that images included in a mail with the ‘cid:’ URL are
safe (that is, you can display such images without modifying the
mm-w3m-safe-url-regexp
variable).
Even when you are in the summary buffer, you can toggle displaying of images in the article buffer. It is effective only when those images are displayed by emacs-w3m, though. Here’s an example:
(defun gnus-summary-w3m-safe-toggle-inline-images (&optional arg) "Toggle displaying of all images in the article buffer. If the prefix arg is given, force displaying of images." (interactive "P") (with-current-buffer gnus-article-buffer (let ((st (point-min)) (nd (point-max)) (w3m-async-exec w3m-async-exec)) (save-restriction (widen) (if (or (> st (point-min)) (< nd (point-max))) (setq w3m-async-exec nil)) (article-goto-body) (goto-char (or (text-property-not-all (point) (point-max) 'w3m-safe-url-regexp nil) (point))) (if (interactive-p) (call-interactively 'w3m-toggle-inline-images) (w3m-toggle-inline-images arg)))))) (eval-after-load "gnus-sum" '(define-key gnus-summary-mode-map "vi" 'gnus-summary-w3m-safe-toggle-inline-images)) |
You can change the key vi into something another. Also see (gnus)Summary Buffer section ‘Summary Buffer’ in The Gnus Manual.
See also Turning Gnus into a web browser!.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by TSUCHIYA Masatoshi on January 30, 2019 using texi2html 1.82.