From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/67740 Path: news.gmane.org!not-for-mail From: Rupert Swarbrick Newsgroups: gmane.emacs.gnus.general Subject: Re: Auto-overriding *.pdf application/octet-stream MIME type? Date: Mon, 03 Nov 2008 18:13:43 +0000 Message-ID: <87d4hcwuco.fsf@gmail.com> References: <873ai9dp1a.fsf@mocca.josefsson.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1225736074 30617 80.91.229.12 (3 Nov 2008 18:14:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Nov 2008 18:14:34 +0000 (UTC) Cc: ding@gnus.org To: Greg Troxel Original-X-From: ding-owner+M16191@lists.math.uh.edu Mon Nov 03 19:15:36 2008 connect(): Connection refused Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kx3xX-0000mb-HJ for ding-account@gmane.org; Mon, 03 Nov 2008 19:15:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Kx3w3-0004fB-So; Mon, 03 Nov 2008 12:13:55 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Kx3w2-0004et-EN for ding@lists.math.uh.edu; Mon, 03 Nov 2008 12:13:54 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.69) (envelope-from ) id 1Kx3vy-000333-QO for ding@lists.math.uh.edu; Mon, 03 Nov 2008 12:13:54 -0600 Original-Received: from ey-out-2122.google.com ([74.125.78.26]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1Kx3w7-0006N1-00 for ; Mon, 03 Nov 2008 19:13:59 +0100 Original-Received: by ey-out-2122.google.com with SMTP id 5so814097eyj.59 for ; Mon, 03 Nov 2008 10:13:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version:content-type:from; bh=nbYl3+G+Ml+yqbAkU62Hx6x71Q/AVKuEAhFDYNYedck=; b=ISJfHap/8T/14uD8IjFmHPRlM0bSojKOxHPAgu2TkQfSELI4ddr/L689VH8YwfBaxW 8dDT6Cn+ziRMcveRF8IoHONdDV6VE1eG8emuiN7kC6Lic46tSj/iKQrXs+aaX6m7OT98 rPTBfy4SWim++F5ymce710nz3P8WfU4b8v8ZY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=to:cc:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type:from; b=Sae9HvMJF4oVPH84/MYspS9llb/OWchffdOijk+s9UwitGNBM+72qwm2tNtqICpfyM ScszRkCBQ9UJZ/JAKv61ejN32p3/u7OfSFKvSp2sdk/mcY4qtSAKRW6TCmGVW3R1ZdOJ CegzDseQbkwJhM2zp71XiC8PXVitetbWtgLoA= Original-Received: by 10.210.139.15 with SMTP id m15mr434498ebd.182.1225736029209; Mon, 03 Nov 2008 10:13:49 -0800 (PST) Original-Received: from hake (cpc2-cove3-0-0-cust513.sol2.cable.ntl.com [86.20.34.2]) by mx.google.com with ESMTPS id q9sm774342gve.9.2008.11.03.10.13.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 03 Nov 2008 10:13:48 -0800 (PST) In-Reply-To: (Greg Troxel's message of "Mon, 03 Nov 2008 07:52:54 -0500") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) X-Spam-Score: -2.6 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:67740 Archived-At: --=-=-= Greg Troxel writes: > From: Simon Josefsson > > What do people think about a variable that can be used to auto-override > MIME types based on filename extensions? I get a lot of *.pdf marked as > application/octet-stream and selecting 'View as Type' feels dull. > > I have been annoyed by dealing with messages that come with wrong mime > types and definitely second the notion that support would be nice. > > Something like this: > > (setq mm-content-type-mapping > '(("application/octet-stream" "*.pdf" "application/pdf"))) > > The cells would be of the form (INCOMING-TYPE EXTENSION MAPPED-TYPE), > and either of INCOMING-TYPE or EXTENSION can be nil to match anything. > > That looks good to me. I would have at first left out the first item, > but on reflection I think that almost all miscoded objects are labeled > application/octet-stream. This lets one have the narrowest effective > configuration. May I suggest that a list of 3 elements is as above, but one can leave out the first to match all incoming MIME types? So ("application/octet-stream" "*.pdf" "application/pdf") would be as above and ("*.pdf" "application/pdf") would match more - anything called blah.pdf would be relabelled application/pdf no matter what MIME type it had. But I'd suggest that both the first and the second values were treated as regexes. Then I can say things like (".*xml.*" ".*" "application/xml") (that was off the top of my head. There are probably better examples). Also, maybe one should allow some magic, so that "*.pdf" gets turned into ".*\.pdf" for newish users not to get bitten. Maybe rewrite anything of the form ^\*\.\(.*\)$ to ^.*\.\\1$ Or maybe strip off the "*" bit and don't require the ^,$? Anyway, I suspect this problem (of regexes vs shell globs) has been given a canonical solution somewhere else in the emacs code-base. Does anyone know? Rupert --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iJwEAQECAAYFAkkPP1gACgkQRtd/pJbYVoYrWgQAgKxtY5558tfNqmHD2RIeKCKc KlgjBvDIP3EgyeOcUqQdUcAxDwbVSNKAqkDyGGyao1XrQUl9zywZocYjGg2Al4XJ 8OTUwKXxEEpD4p+RCPvioreC3HhCp89wtYpiqtBKcBuEFY3dNiVr2CABxzBY8LpJ 9msiKEnwTZvfd3ikd+g= =G87p -----END PGP SIGNATURE----- --=-=-=--