From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/29632 Path: main.gmane.org!not-for-mail From: Kim-Minh Kaplan Newsgroups: gmane.emacs.gnus.general Subject: Re: Forcing type/subtype ? Date: 27 Mar 2000 15:58:34 +0200 Organization: Gnus Information Center Sender: owner-ding@hpc.uh.edu Message-ID: <871z4wy0ol.fsf@kloug.western.fr> References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035166272 3816 80.91.224.250 (21 Oct 2002 02:11:12 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 02:11:12 +0000 (UTC) Return-Path: Original-Received: from lisa.math.uh.edu (lisa.math.uh.edu [129.7.128.49]) by mailhost.sclp.com (Postfix) with ESMTP id AE981D051E for ; Mon, 27 Mar 2000 08:59:34 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by lisa.math.uh.edu (8.9.1/8.9.1) with ESMTP id HAB27075; Mon, 27 Mar 2000 07:59:20 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 27 Mar 2000 07:58:53 -0600 (CST) Original-Received: from mailhost.sclp.com (postfix@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id HAA00565 for ; Mon, 27 Mar 2000 07:58:38 -0600 (CST) Original-Received: from quimby.gnus.org (quimby.gnus.org [193.69.4.139]) by mailhost.sclp.com (Postfix) with ESMTP id DCAD3D051E for ; Mon, 27 Mar 2000 08:58:37 -0500 (EST) Original-Received: (from news@localhost) by quimby.gnus.org (8.9.3/8.9.3) id QAA20455 for ding@gnus.org; Mon, 27 Mar 2000 16:00:32 +0200 (CEST) Original-To: ding@gnus.org Original-Path: not-for-mail Original-Newsgroups: gnus.ding Original-Lines: 72 Original-NNTP-Posting-Host: ext0.western.fr Original-X-Trace: quimby.gnus.org 954165632 29478 195.101.52.157 (27 Mar 2000 14:00:32 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: 27 Mar 2000 14:00:32 GMT Mail-Copies-To: never X-Face: C!5Mk_!qB]35}VpD|H>GN/@fk%~7:*/x8&~\]|r|)/zV?rJ){uX4Nh`a$L/z__Kx4Gt!mDU 3kZlj)F2]Ds$?l';SO9]v^|[i2nY`pZ+mu+HT%5ITkuP#e]@8F4@Hc.=]oN1+d\M@Rl>-$C?h$yntf -JVx)3L2}VzG.!bQEy]~I_3fup`HtZ^t/Iz.|Vh$~o`^g\ User-Agent: Gnus/5.0804 (Gnus v5.8.4) XEmacs/21.1 (Bryce Canyon) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:29632 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:29632 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit François Pinard writes: > Hi, people. Is there a quick way, from a Gnus Summary, say, to force the > interpretation of a part to be done according to some type/subtype? > > The precise need triggering this question is a message lacking MIME > headers and containing an HTML part. It would be fun being able to say: > "Hey, my dear and beloved Gnus, please be kind and show me this message > (or more generally, this part) as if MIME headers told `text/html'...". Here is what I use for this purpose. I think it would be nice to put this in CVS (I can't do that) if it works for everybody. Kim-Minh. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gnus.patch Content-Description: Gnus patch to force type/subtype on mime parts Index: lisp/gnus-art.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v retrieving revision 5.114 diff -u -r5.114 gnus-art.el --- lisp/gnus-art.el 2000/03/07 14:28:53 5.114 +++ lisp/gnus-art.el 2000/03/27 13:56:30 @@ -2840,14 +2840,33 @@ (let ((data (get-text-property (point) 'gnus-data))) (mm-interactively-view-part data))) -(defun gnus-mime-view-part-as-type () +(defun gnus-mime-view-part-as-type-internal () + (gnus-article-check-buffer) + (let* ((name (mail-content-type-get + (mm-handle-type (get-text-property (point) 'gnus-data)) + 'name)) + (def-type (and name (mm-default-file-encoding name)))) + (and def-type (cons def-type 0)))) + +(defun gnus-mime-view-part-as-type (mime-type) "Choose a MIME media type, and view the part as such." (interactive - (list (completing-read "View as MIME type: " - (mapcar 'list (mailcap-mime-types))))) + (list (completing-read + "View as MIME type: " + (mapcar (lambda (i) (list i i)) (mailcap-mime-types)) + nil nil + (gnus-mime-view-part-as-type-internal)))) (gnus-article-check-buffer) (let ((handle (get-text-property (point) 'gnus-data))) - (gnus-mm-display-part handle))) + (gnus-mm-display-part + (mm-make-handle (mm-handle-buffer handle) + (cons mime-type (cdr (mm-handle-type handle))) + (mm-handle-encoding handle) + (mm-handle-undisplayer handle) + (mm-handle-disposition handle) + (mm-handle-description handle) + (mm-handle-cache handle) + (mm-handle-id handle))))) (defun gnus-mime-copy-part (&optional handle) "Put the the MIME part under point into a new buffer." --=-=-=--