From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/25627 Path: main.gmane.org!not-for-mail From: Toby Speight Newsgroups: gmane.emacs.gnus.general Subject: Re: Adding MIME viewers Date: 04 Oct 1999 13:06:15 +0100 Organization: Citrix Systems (Cambridge) Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035162979 15021 80.91.224.250 (21 Oct 2002 01:16:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 01:16:19 +0000 (UTC) Return-Path: Original-Received: from spinoza.math.uh.edu (spinoza.math.uh.edu [129.7.128.18]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id IAA25874 for ; Mon, 4 Oct 1999 08:11:53 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by spinoza.math.uh.edu (8.9.1/8.9.1) with ESMTP id HAB20846; Mon, 4 Oct 1999 07:07:49 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 04 Oct 1999 07:08:29 -0500 (CDT) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id HAA15187 for ; Mon, 4 Oct 1999 07:08:19 -0500 (CDT) Original-Received: from gatekeeper.ctxuk.citrix.com (root@gatekeeper.ctxuk.citrix.com [195.153.38.114]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id IAA25857 for ; Mon, 4 Oct 1999 08:06:20 -0400 (EDT) Original-Received: from sh.ctxuk.citrix.com (sh.ctxuk.citrix.com [10.30.224.4]) by gatekeeper.ctxuk.citrix.com (8.8.7/BSCF-1.7) with ESMTP id NAA06938 for ; Mon, 4 Oct 1999 13:06:17 +0100 (BST) Original-Received: from hwmail01.ctxuk.citrix.com (hwmail01.ctxuk.citrix.com [10.30.224.23]) by sh.ctxuk.citrix.com (8.8.7/BSCF-1.7) with ESMTP id NAA05066 for ; Mon, 4 Oct 1999 13:06:16 +0100 (BST) Original-Received: from lanber.cam.citrix.com (LANBER [10.70.1.235]) by hwmail01.ctxuk.citrix.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2448.0) id T1024H6A; Mon, 4 Oct 1999 13:06:16 +0100 Original-To: The Gnus Mailing List Original-Lines: 43 In-Reply-To: Lars Magne Ingebrigtsen's message of "25 Sep 1999 10:59:41 +0200" X-Author-Info: Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:25627 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:25627 Lars> Lars Magne Ingebrigtsen 0> Toby Speight writes: >> Has anyone written a good guide for writing viewers for MIME-types >> not built-in to Gnus? In particular, I've recently installed >> Stefan Monnier's diff-mode.el, and I'd like to use his font-lock >> rules to fontify "text/x-patch" bodyparts. 0> In article , Lars wrote: Lars> I've now added the following section to the Emacs-MIME manual: Lars> Lars> New Viewers Lars> =========== Lars> Lars> [...] So here's my viewer for application/x-diff: (defun mm-display-patch-inline (handle) (let (text) (with-temp-buffer (mm-insert-part handle) (diff-mode) (font-lock-fontify-buffer) (setq text (buffer-string))) (mm-insert-inline handle text))) (eval-after-load "mm-decode" '(progn (push '("text/x-patch" mm-display-patch-inline identity) mm-inline-media-tests) (push "text/x-patch" mm-automatic-display) (push "text/x-patch" mm-inlined-types) (push "text/x-patch" mm-attachment-override-types))) I guess I ought to put something more useful in `mm-inline-media-tests', like (fboundp 'diff-mode), but I thought others may find this useful. (For those who don't have diff-mode, search gnu.emacs.sources over 1999 for Stefan Monnier's code.)