I am sending an updated version of the patch, earlier I missed one occurrence of text/org.

I am leaving it up to you the decision concerning mailcap.el.

On 02/02/2024 14:09, Stefan Kangas wrote:
So why not:

  1. Add support for _receiving_ "text/org" in Emacs 30
  2. Wait with _sending_ "text/org" until it is formally accepted by IANA

I do not mind. I just do not see real reasons to do so taking into account applicaion/vnd.lotus-organizer in Emacs and text/org in XDG.

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

Is that documented somewhere in our documentation?

Likely it is not. It is documented in man pages for various tools. In Emacs-27 mailcap.el was severely broken, so I do not expect detailed documentation.

Yes, that would be best.  While waiting for that to happen, why not do
what I proposed (override it unconditionally in Emacs)?  It should be
more useful for Emacs users, if nothing else.

It has happened so that I has spent some time reading Python bug tracker concerning their mimetypes module. I suggest against doing it unconditionally. Give users controls what sources should be used and what priority each source should have (application internal mapping, system-wide configuration files, user configuration files, Windows registry, XDG files as possible future improvement). Inconsistencies are not uncommon, updates of the IANA registry are applied with different pace.

Taking a step back, how sure are we that IANA will accept this?  Do they
typically accept taking over a previous designation?

An alternative is to negotiate with maintainers of mime.types in RedHat and Debian. My first impression is that in the case of Debian it may take enough time before any reaction. I am unsure as well that IANA will agree to change media type for .org without approval from IBM.
From 9f0950075bbfbfc1ff1080ee410c66e1953197d7 Mon Sep 17 00:00:00 2001
From: Max Nikulin <maniku...@gmail.com>
Date: Wed, 24 Jan 2024 21:16:28 +0700
Subject: [PATCH v2] Use text/org media type

Avoid "x-" prefix deprecated by rfc6648 for Org mode media type.
* lisp/net/mailcap.el (mailcap-mime-extensions):
* lisp/gnus/mm-uu.el (mm-uu-org-src-code-block-extract): Replace
text/x-org by text/org.
* lisp/gnus/mm-decode.el (mm-inline-media-tests, mm-automatic-display):
Allow text/org in addition to text/x-org.

Make media type defined for Org mode consistent with
<https://gitlab.freedesktop.org/xdg/shared-mime-info>

See emacs-orgmode: Org mode MIME type. Sun, 21 Jan 2024 20:56:15 +0700.
https://list.orgmode.org/6d94fff4-4d30-4121-bfd1-f267cb5b6...@gmail.com
---
 lisp/gnus/mm-decode.el | 2 ++
 lisp/gnus/mm-uu.el     | 2 +-
 lisp/net/mailcap.el    | 3 ++-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index f91755e967b..8086c97fe55 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -246,6 +246,7 @@ (defcustom mm-inline-media-tests
     ("text/x-sh" mm-display-shell-script-inline identity)
     ("application/javascript" mm-display-javascript-inline identity)
     ("text/dns" mm-display-dns-inline identity)
+    ("text/org" mm-display-org-inline identity)
     ("text/x-org" mm-display-org-inline identity)
     ("text/html"
      mm-inline-text-html
@@ -336,6 +337,7 @@ (defcustom mm-automatic-display
     "application/pkcs7-mime"
     ;; Mutt still uses this even though it has already been withdrawn.
     "application/pgp\\'"
+    "text/org"
      "text/x-org")
   "A list of MIME types to be displayed automatically."
   :type '(repeat regexp)
diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
index 3c7e3cbdf1a..b10da0c143a 100644
--- a/lisp/gnus/mm-uu.el
+++ b/lisp/gnus/mm-uu.el
@@ -394,7 +394,7 @@ (defun mm-uu-emacs-sources-extract ()
 
 (defun mm-uu-org-src-code-block-extract ()
   (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
-		  '("text/x-org" (charset . gnus-decoded))))
+		  '("text/org" (charset . gnus-decoded))))
 
 (defvar gnus-newsgroup-name)
 
diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
index 5ff75deb4e6..900099433c4 100644
--- a/lisp/net/mailcap.el
+++ 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"))
   "An alist of file extensions and corresponding MIME content-types.
 This exists for you to customize the information in Lisp.  It is
 merged with values from mailcap files by `mailcap-parse-mimetypes'.")
-- 
2.39.2

Reply via email to