Gnus development mailing list
 help / color / mirror / Atom feed
From: Toby Speight <Toby.Speight@streapadair.freeserve.co.uk>
Subject: Re: Adding MIME viewers
Date: 04 Oct 1999 13:06:15 +0100	[thread overview]
Message-ID: <uiu4n9vpk.fsf@lanber.cam.citrix.com> (raw)
In-Reply-To: Lars Magne Ingebrigtsen's message of "25 Sep 1999 10:59:41 +0200"

Lars> Lars Magne Ingebrigtsen <URL:mailto:larsi@gnus.org>

0> Toby Speight <Toby.Speight@streapadair.freeserve.co.uk> 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 <m33dw374ea.fsf@quimbies.gnus.org>, 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.)



  parent reply	other threads:[~1999-10-04 12:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-10  9:48 Toby Speight
1999-09-25  8:59 ` Lars Magne Ingebrigtsen
1999-09-27 13:44   ` Toby Speight
1999-09-27 14:07     ` Lars Magne Ingebrigtsen
1999-10-04 12:06   ` Toby Speight [this message]
1999-10-09 14:20     ` Robert Bihlmeyer
1999-10-11  8:51       ` Hrvoje Niksic
1999-11-06  2:53     ` 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=uiu4n9vpk.fsf@lanber.cam.citrix.com \
    --to=toby.speight@streapadair.freeserve.co.uk \
    /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).