* Forcing type/subtype ?
@ 2000-03-18 2:24 François Pinard
2000-03-18 4:19 ` Karl Kleinpaste
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: François Pinard @ 2000-03-18 2:24 UTC (permalink / raw)
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'...".
--
François Pinard http://www.iro.umontreal.ca/~pinard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Forcing type/subtype ?
2000-03-18 2:24 Forcing type/subtype ? François Pinard
@ 2000-03-18 4:19 ` Karl Kleinpaste
2000-03-18 10:30 ` Kai Großjohann
2000-03-27 13:58 ` Kim-Minh Kaplan
2 siblings, 0 replies; 4+ messages in thread
From: Karl Kleinpaste @ 2000-03-18 4:19 UTC (permalink / raw)
François Pinard <pinard@IRO.UMontreal.CA> writes:
> The precise need triggering this question is a message lacking MIME
> headers and containing an HTML part.
Oooh. Yeah. I somewhat routinely find myself needing to re-interpret
e.g. an application/octet-stream as an image/jpeg or somesuch thing.
I'd rather not edit the message in order to accomplish this -- I only
want the re-interpretation transiently.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Forcing type/subtype ?
2000-03-18 2:24 Forcing type/subtype ? François Pinard
2000-03-18 4:19 ` Karl Kleinpaste
@ 2000-03-18 10:30 ` Kai Großjohann
2000-03-27 13:58 ` Kim-Minh Kaplan
2 siblings, 0 replies; 4+ messages in thread
From: Kai Großjohann @ 2000-03-18 10:30 UTC (permalink / raw)
Cc: Forum of ding/Gnus users
François Pinard <pinard@IRO.UMontreal.CA> 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?
gnus-mime-view-part-as-type
kai
--
~/.signature: No such file or directory
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Forcing type/subtype ?
2000-03-18 2:24 Forcing type/subtype ? François Pinard
2000-03-18 4:19 ` Karl Kleinpaste
2000-03-18 10:30 ` Kai Großjohann
@ 2000-03-27 13:58 ` Kim-Minh Kaplan
2 siblings, 0 replies; 4+ messages in thread
From: Kim-Minh Kaplan @ 2000-03-27 13:58 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 607 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Gnus patch to force type/subtype on mime parts --]
[-- Type: text/x-patch, Size: 1705 bytes --]
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."
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-03-27 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-18 2:24 Forcing type/subtype ? François Pinard
2000-03-18 4:19 ` Karl Kleinpaste
2000-03-18 10:30 ` Kai Großjohann
2000-03-27 13:58 ` Kim-Minh Kaplan
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).