From: Alan Shutko <ats@acm.org>
Subject: Patch: Fall back to alternate part if viewing fails
Date: Sat, 06 Nov 2004 18:19:07 -0600 [thread overview]
Message-ID: <87actubjes.fsf@wesley.springies.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 557 bytes --]
Here's a patch I've been using to fall back to text/plain parts if w3
fails to render. It should work with any viewers which fail, to fall
back to the non-preferred part.
2004-11-06 Alan Shutko <ats@acm.org>
* mm-view.el (mm-inline-text-html-render-with-w3): Don't catch
the w3 error. Instead, let it propagate so that higher-levels
can decide what to do.
* gnus-art.el (gnus-mime-display-alternative): If a viewer fails,
try the non-preferred part.
--
Alan Shutko <ats@acm.org> - I am the rocks.
Remember, what you don't mean can't hurt you.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: alternate.diff --]
[-- Type: text/x-patch, Size: 1907 bytes --]
Index: lisp/mm-view.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mm-view.el,v
retrieving revision 7.19
diff -u -r7.19 mm-view.el
--- lisp/mm-view.el 21 Oct 2004 12:55:25 -0000 7.19
+++ lisp/mm-view.el 7 Nov 2004 00:14:30 -0000
@@ -156,25 +156,7 @@
;; Don't let w3 set the global version of
;; this variable.
(fill-column fill-column))
- (if (or debug-on-error debug-on-quit)
- (w3-region (point-min) (point-max))
- (condition-case ()
- (w3-region (point-min) (point-max))
- (error
- (delete-region (point-min) (point-max))
- (let ((b (point))
- (charset (mail-content-type-get
- (mm-handle-type handle) 'charset)))
- (if (or (eq charset 'gnus-decoded)
- (eq mail-parse-charset 'gnus-decoded))
- (save-restriction
- (narrow-to-region (point) (point))
- (mm-insert-part handle)
- (goto-char (point-max)))
- (insert (mm-decode-string (mm-get-part handle)
- charset))))
- (message
- "Error while rendering html; showing as text/plain")))))))
+ (w3-region (point-min) (point-max)))))
(mm-handle-set-undisplayer
handle
`(lambda ()
Index: lisp/gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 7.60
diff -u -r7.60 gnus-art.el
--- lisp/gnus-art.el 4 Nov 2004 06:24:21 -0000 7.60
+++ lisp/gnus-art.el 7 Nov 2004 00:14:32 -0000
@@ -4829,7 +4829,11 @@
(mail-parse-ignored-charsets
(with-current-buffer gnus-summary-buffer
gnus-newsgroup-ignored-charsets)))
- (mm-display-part preferred)
+ (condition-case ()
+ (mm-display-part preferred)
+ (error
+ (delete-region (car begend) (point-max))
+ (mm-display-part not-pref)))
;; Do highlighting.
(save-excursion
(save-restriction
next reply other threads:[~2004-11-07 0:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-07 0:19 Alan Shutko [this message]
2006-04-15 12:47 ` Lars Magne Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87actubjes.fsf@wesley.springies.com \
--to=ats@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).