From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/59065 Path: main.gmane.org!not-for-mail From: Alan Shutko Newsgroups: gmane.emacs.gnus.general Subject: Patch: Fall back to alternate part if viewing fails Date: Sat, 06 Nov 2004 18:19:07 -0600 Message-ID: <87actubjes.fsf@wesley.springies.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1099787313 6045 80.91.229.6 (7 Nov 2004 00:28:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 7 Nov 2004 00:28:33 +0000 (UTC) Original-X-From: ding-owner+M7605@lists.math.uh.edu Sun Nov 07 01:28:18 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13] ident=mail) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CQauo-0002r7-00 for ; Sun, 07 Nov 2004 01:28:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1CQare-0003ws-00; Sat, 06 Nov 2004 18:25:02 -0600 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1CQarW-0003wk-00 for ding@lists.math.uh.edu; Sat, 06 Nov 2004 18:24:54 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by util2.math.uh.edu with esmtp (Exim 4.30) id 1CQarU-0004uS-4e for ding@lists.math.uh.edu; Sat, 06 Nov 2004 18:24:52 -0600 Original-Received: from simon.springies.com (125-102.bestdsl.net [216.162.125.102]) by justine.libertine.org (Postfix) with ESMTP id 83D4F3A0027 for ; Sat, 6 Nov 2004 18:24:47 -0600 (CST) Original-Received: from wesley.springies.com (wesley.springies.com [192.168.1.2]) by simon.springies.com (Postfix) with ESMTP id B3D813EC3 for ; Sat, 6 Nov 2004 18:24:45 -0600 (CST) Original-Received: by wesley.springies.com (Postfix, from userid 1000) id 507BABC33; Sat, 6 Nov 2004 18:24:45 -0600 (CST) Original-To: ding@gnus.org User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: main.gmane.org gmane.emacs.gnus.general:59065 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:59065 --=-=-= 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 * 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 - I am the rocks. Remember, what you don't mean can't hurt you. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=alternate.diff 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 --=-=-=--