From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/25321 Path: main.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.gnus.general Subject: Re: Adding MIME viewers Date: 25 Sep 1999 10:59:41 +0200 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 1035162727 13375 80.91.224.250 (21 Oct 2002 01:12:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 01:12:07 +0000 (UTC) Return-Path: Original-Received: from bart.math.uh.edu (bart.math.uh.edu [129.7.128.48]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id FAA11139 for ; Sat, 25 Sep 1999 05:02:38 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by bart.math.uh.edu (8.9.1/8.9.1) with ESMTP id EAB17874; Sat, 25 Sep 1999 04:02:04 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sat, 25 Sep 1999 04:02:11 -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 EAA15177 for ; Sat, 25 Sep 1999 04:01:14 -0500 (CDT) Original-Received: from quimbies.gnus.org (sparky.gnus.org [193.69.4.146]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id EAA11064 for ; Sat, 25 Sep 1999 04:59:12 -0400 (EDT) Original-Received: (from larsi@localhost) by quimbies.gnus.org (8.8.7/8.8.7) id LAA30934; Sat, 25 Sep 1999 11:01:57 +0200 Mail-Copies-To: never X-Now-Playing: Stereolab's _Cobra and Phases Group Play Voltage in the Milky Night_: "Blue Milk" Original-To: ding@gnus.org In-Reply-To: Toby Speight's message of "10 Sep 1999 10:48:46 +0100" User-Agent: Gnus/5.070097 (Pterodactyl Gnus v0.97) XEmacs/21.2 (Sumida) X-Face: &w!^oO~dS|}-P0~ge{$c!h\ 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. I've now added the following section to the Emacs-MIME manual: New Viewers =========== Here's an example viewer for displaying `text/enriched' inline: (defun mm-display-enriched-inline (handle) (with-temp-buffer (mm-insert-part handle) (save-window-excursion (enriched-decode (point-min) (point-max)) (setq text (buffer-string)))) (mm-insert-inline handle text)) We see that the function takes a MIME handle as its parameter. It then goes to a temporary buffer, inserts the text of the part, does some work on the text, stores the result, goes back to the buffer it was called from and inserts the result. The two important helper functions here are `mm-insert-part' and `mm-insert-inline'. The first function inserts the text of the handle in the current buffer. It handles charset and/or content transfer decoding. The second function just inserts whatever text you tell it to insert, but it also sets things up so that the text can be "undisplayed' in a convenient manner. -- (domestic pets only, the antidote for overdose, milk.) larsi@gnus.org * Lars Magne Ingebrigtsen