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

From: Max Nikulin <[email-masked]>
Date: Wed, 24 Jan 2024 21:43:55 +0700

Hi,

I suggest to make the media type used for Org mode files consistent with 
the one used by XDG https://gitlab.freedesktop.org/xdg/shared-mime-info
Currently Emacs has text/x-org, however "x-" prefix is not recommended 
by IANA any more, see https://www.rfc-editor.org/rfc/rfc6648 
"Deprecating the "X-" Prefix and Similar Constructs in Application 
Protocols"

Ideally somebody should file a request to IANA to register the text/org 
media type.
https://www.iana.org/assignments/media-types/media-types.xhtml
However I have no idea concerning a conflict due to the .org file name 
suffix. It was used in the past by early versions of Lotus Organizer. 
https://www.iana.org/assignments/media-types/application/vnd.lotus-organizer

I am unsure if gnus-related code should be committed to some other 
repository at first. I am not a gnus user, so I do not mind if an 
alternative change will be committed.

See also
emacs-orgmode: Org mode MIME type. Sun, 21 Jan 2024 20:56:15 +0700.
https://list.orgmode.org/[email-masked]
From 8b71393625f11590e99896808bbd04ed83f7917e Mon Sep 17 00:00:00 2001
From: Max Nikulin <[email-masked]>
Date: Wed, 24 Jan 2024 21:16:28 +0700
Subject: [PATCH] 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): 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/[email-masked]
---
 lisp/gnus/mm-decode.el | 1 +
 lisp/gnus/mm-uu.el     | 2 +-
 lisp/net/mailcap.el    | 3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index f91755e967b..cae737e5a3e 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
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