emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Org mode MIME type


From: Max Nikulin
Subject: Org mode MIME type
Date: Sun, 21 Jan 2024 20:56:15 +0700
User-agent: Mozilla Thunderbird

Hi,

I have been surprised when I got

    xdg-mime query filetype /tmp/test.org
    text/org

for a following file

    cat /tmp/test.org
    * A section

    An example of Org mode file

It is pleasant, however shouldn't it be "text/x-org", not just "text/org"? (I am against "application/*" variants since it is a text based format).

1. The MIME type has not registered in IANA, so the "x-" prefix should be preferable
<https://www.iana.org/assignments/media-types/media-types.xhtml>

2. It would be in line with

    emacs -Q -l mailcap --batch \
        --eval '(prin1 (assoc ".org" mailcap-mime-extensions))' \
        --eval '(terpri)'
    (".org" . "text/x-org")

I have not found any discussion of the following commit that is a part of shared-mime-info 2.2 release:
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/commit/4dd4fd5cb54d03cb73102c6f1f674675b5186e47
2021-05-27T20:27:31Z David Faure adding org-mode

  <mime-type type="text/org">
    <comment>Org-mode file</comment>
    <sub-class-of type="text/plain"/>
    <glob pattern="*.org"/>
  </mime-type>

I think, "type" should be "text/x-org" here, perhaps "text/org" alias may be added to this entry to not break workflow of those who already have text/org e.g. in mail messages.

By the way, shouldn't description be "Org mode file" without a dash? See org-mode/doc/Documentation_Standards.org

- Prefer "Org mode" to "Org-mode" or "org-mode".  This is simply
  because it reflects an existing convention in [[info:emacs:Top][The Emacs 
Manual]] which
  consistently documents mode names in this form - "Text mode",
  "Outline mode", "Mail mode", etc.

Actually it is more complicated:

    file --mime /tmp/test.org
    /tmp/test.org: text/plain; charset=us-ascii

It is expected, since "file" relies solely on file signatures (magic bytes) and text files have no specific ones. A more perplexing result is

    emacs -Q -l mailcap --batch \
    --eval '(prin1 (mailcap-file-name-to-mime-type "/tmp/test.org"))' \
    --eval '(terpri)'
    "application/vnd.lotus-organizer"

in agreement with run-mailcap that reads /etc/mime.types

    see --norun /tmp/test.org
Error: no "view" mailcap rules found for type "application/vnd.lotus-organizer"

I am unsure if it is possible to convince maintainers of
https://salsa.debian.org/debian/media-types
and
https://pagure.io/mailcap
to change mapping of .org originating from IANA, but certainly it would be easier for text/x-org than for text/org. IBM seized support of Lotus Organizer many years ago and only early versions around 1992 used .org suffix, later ones used or2...or6 extensions.

In the case of Emacs text/org was replaced by text/x-org:

https://list.orgmode.org/87aaiufaoj.fsf@gmail.com/T/#u
Subject: Re: Adding a new text/org mime type
Date: Fri, 21 Jan 2011 18:06:52 +0100
From: "Štěpán Němec"

Should we ask maintainers of shared-mime-info to update the Org mode entry?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]