Subject: Re: bug#68687: [PATCH] Use text/org media type

From: Max Nikulin <[email-masked]>
Date: Thu, 1 Feb 2024 17:40:21 +0700

On 01/02/2024 03:00, Stefan Kangas wrote:
> Max Nikulin writes:
>> +++ b/lisp/net/mailcap.el
>> @@ -989,7 +989,8 @@ (defvar mailcap-mime-extensions
>>       (".jpe"   . "image/jpeg")
>>       (".jpeg"  . "image/jpeg")
>>       (".webp"  . "image/webp")
>> -    (".org"   . "text/x-org"))
>> +    ;; May be overridden by application/vnd.lotus-organizer in /etc/mime.types.
>> +    (".org"   . "text/org"))
> 
> With this patch, what happens if someone is emailing using an old
> version of Emacs?  Does that matter, or is this stuff based only on the
> file ending?

Org files are plain text files and have no specific signature that would 
allow tools like libmagic to unambiguously distinguish them from other 
text files. Rare files have explicit "# -*- mode: org-mode -*-" header. 
So there is no other way besides file name extensions when a message is 
composed or a file is served by a HTTP server. Clients should rely on 
the Content-Type header.

Old mailers will continue sending messages with 
application/vnd.lotus-organizer, text/x-org, or text/org media type.

> IOW, I'm asking if it is backwards-compatible to remove
> "text/org", in either direction.

I suggest to use text/org instead of text/x-org.

> Will .org files be displayed in the
> same way as before or not on both new and old versions?

I do not see a better way toward consistency in respect to the media type.

> I've noticed on my machine that .org files have been interpreted as
> application/vnd.lotus-organizer.

 From my point of view, it is a reason to not bother concerning removing 
of "text/x-org" from `mailcap-mime-extensions'

> Presumably that's due to some local
> configuration in /etc/mime.types on my distro.  Is that correct?

There are 2 projects maintaining /etc/mime.types, they follows IANA 
registry, so have application/vnd.lotus-organizer. XDG shared-mime-info 
project (another media types DB, not /etc/mime.types) has text/org.

> Is it
> documented somewhere how to override that system configuration in Emacs?

Create ~/.mime.types. Debian's variant suggests it in the 
/etc/mime.types header.

> But thinking about this more, why not do that unconditionally for users?
> Lotus Organizer is dead, long gone, and not really relevant to anyone,
> certainly not to the overwhelming majority of Emacs users.

Ideally text/org should be registered in IANA, so all applications could 
use consistent mapping. Prerequisites have been discussed already.