Gnus development mailing list
 help / color / mirror / Atom feed
* Guessing based on file extension
@ 2000-01-02  7:24 Lars Magne Ingebrigtsen
  2000-01-02  7:43 ` Daniel Pittman
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Lars Magne Ingebrigtsen @ 2000-01-02  7:24 UTC (permalink / raw)


François suggested the following definition of this function:

(defun mm-interactively-view-part (handle)
     "Display HANDLE using METHOD."
     (let ((type (mm-handle-media-type handle)))
       (when (string-equal type "application/octet-stream")
	 (let ((name (mail-content-type-get (mm-handle-type handle) 'name)))
	   (when name
	     (let ((new-type (mm-default-file-encoding name)))
	       (when new-type
		 (setq type new-type))))))
       (let* ((methods
	       (mapcar (lambda (i) (list (cdr (assoc 'viewer i))))
		       (mailcap-mime-info type 'all)))
	      (method (completing-read "Viewer: " methods)))
	 (mm-display-external (copy-sequence handle) method))))

If the type is "application/octet-stream", then we look at the thing
after the dot, and use that as the "real" type.

On the one hand, this is user friendly.  On the other hand, guessing
is yucky.  One could add a used config variable to control whether to
do it or not, but if that defaults to nil, then that won't be very
used friendly.

So.  Whaddayall think?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2000-01-05 18:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-02  7:24 Guessing based on file extension Lars Magne Ingebrigtsen
2000-01-02  7:43 ` Daniel Pittman
2000-01-02  8:02 ` Hans de Graaff
2000-01-02 16:09   ` Alan Shutko
2000-01-02 22:42     ` Hans de Graaff
2000-01-02 15:35 ` Per Abrahamsen
2000-01-02 16:11   ` Steinar Bang
2000-01-02 21:24 ` Simon Josefsson
2000-01-03 12:05   ` Steinar Bang
2000-01-04 19:41 ` François Pinard
2000-01-04 23:32   ` Kai Großjohann
2000-01-05  0:02   ` Stainless Steel Rat
2000-01-05  7:47   ` Steinar Bang
2000-01-05 18:29     ` 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).