* Patch: Fall back to alternate part if viewing fails
@ 2004-11-07 0:19 Alan Shutko
2006-04-15 12:47 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Alan Shutko @ 2004-11-07 0:19 UTC (permalink / 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Patch: Fall back to alternate part if viewing fails
2004-11-07 0:19 Patch: Fall back to alternate part if viewing fails Alan Shutko
@ 2006-04-15 12:47 ` Lars Magne Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2006-04-15 12:47 UTC (permalink / raw)
Alan Shutko <ats@acm.org> writes:
> * 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.
It would be the right thing to do for multipart/alternative, but
messages that are just text/html would just be blank. So I don't
think this is totally correct...
--
(domestic pets only, the antidote for overdose, milk.)
larsi@gnus.org * Lars Magne Ingebrigtsen
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-04-15 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-07 0:19 Patch: Fall back to alternate part if viewing fails Alan Shutko
2006-04-15 12:47 ` Lars Magne Ingebrigtsen
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).