unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#68687: [PATCH] Use text/org media type
       [not found] ` <8734uqpvgn.fsf@tec.tecosaur.net>
@ 2024-01-24 14:43   ` Max Nikulin
  2024-01-25 23:10     ` Stefan Kangas
  2024-01-31 20:00     ` Stefan Kangas
  0 siblings, 2 replies; 30+ messages in thread
From: Max Nikulin @ 2024-01-24 14:43 UTC (permalink / raw)
  To: 68687; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

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/6d94fff4-4d30-4121-bfd1-f267cb5b637c@gmail.com

[-- Attachment #2: 0001-Use-text-org-media-type.patch --]
[-- Type: text/x-patch, Size: 2508 bytes --]

From 8b71393625f11590e99896808bbd04ed83f7917e Mon Sep 17 00:00:00 2001
From: Max Nikulin <manikulin@gmail.com>
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/6d94fff4-4d30-4121-bfd1-f267cb5b637c@gmail.com
---
 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


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-24 14:43   ` bug#68687: [PATCH] Use text/org media type Max Nikulin
@ 2024-01-25 23:10     ` Stefan Kangas
  2024-01-25 23:43       ` Ihor Radchenko
                         ` (4 more replies)
  2024-01-31 20:00     ` Stefan Kangas
  1 sibling, 5 replies; 30+ messages in thread
From: Stefan Kangas @ 2024-01-25 23:10 UTC (permalink / raw)
  To: Max Nikulin, 68687; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> 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

Eli, Ihor, what do you think?

> 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/6d94fff4-4d30-4121-bfd1-f267cb5b637c@gmail.com
> From 8b71393625f11590e99896808bbd04ed83f7917e Mon Sep 17 00:00:00 2001
> From: Max Nikulin <manikulin@gmail.com>
> 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/6d94fff4-4d30-4121-bfd1-f267cb5b637c@gmail.com
> ---
>  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





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-25 23:10     ` Stefan Kangas
@ 2024-01-25 23:43       ` Ihor Radchenko
  2024-01-26  7:23       ` Eli Zaretskii
                         ` (3 subsequent siblings)
  4 siblings, 0 replies; 30+ messages in thread
From: Ihor Radchenko @ 2024-01-25 23:43 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 68687, Max Nikulin, emacs-orgmode

Stefan Kangas <stefankangas@gmail.com> writes:

>> 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
>
> Eli, Ihor, what do you think?

I see using text/org as an improvement. text/x-org is likely useless.
At least,
https://github.com/jeremy-compostella/org-msg/blob/master/org-msg.el
uses text/org, which may appear in email parts.

However, AFAIU, text/org will fall into "standards tree" in IANA media
type specification, which means that it MUST be registered, as described
in https://www.rfc-editor.org/rfc/rfc6838.html#section-3.1

Registering text/org media type requires syntax spec. We are
still working on format Org mode syntax specifications. See
https://list.orgmode.org/orgmode/871rjhha8t.fsf@gmail.com/ and
https://orgmode.org/worg/org-syntax.html

The spec is still not fully finalized, so we are not yet initiating the
registration, as we will need to repeat it again if we decide to make
further changes (https://www.rfc-editor.org/rfc/rfc6838.html#section-5.5)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-25 23:10     ` Stefan Kangas
  2024-01-25 23:43       ` Ihor Radchenko
@ 2024-01-26  7:23       ` Eli Zaretskii
  2024-01-26 10:39         ` Max Nikulin
  2024-01-31 16:30         ` Max Nikulin
       [not found]       ` <87h6j1f08d.fsf@localhost>
                         ` (2 subsequent siblings)
  4 siblings, 2 replies; 30+ messages in thread
From: Eli Zaretskii @ 2024-01-26  7:23 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 68687, manikulin, emacs-orgmode

> Cc: emacs-orgmode@gnu.org
> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Thu, 25 Jan 2024 15:10:27 -0800
> 
> Max Nikulin <manikulin@gmail.com> writes:
> 
> > 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
> 
> Eli, Ihor, what do you think?

I agree, but since Ihor indicates that is impossible for now, we will
have to live with the current situation for at least the near future.

So I think we should install these changes, but please audit them
carefully to make sure we don't create any backward-compatibility
problems unnecessarily.  For example:

> > 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"))

I'm not sure the removal of text/x-org in these two hunks is a good
idea: could it perhaps cause trouble to someone, e.g. if an email
message is sent from Emacs with this change and read by Emacs without
it?  (I don't use these packages, so I wouldn't know the answer.)  In
general, I'd prefer changes that add text/org without removing support
for text/x-org.

Thanks.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]       ` <87h6j1f08d.fsf@localhost>
@ 2024-01-26  7:40         ` Eli Zaretskii
  2024-01-26 10:52         ` Max Nikulin
                           ` (3 subsequent siblings)
  4 siblings, 0 replies; 30+ messages in thread
From: Eli Zaretskii @ 2024-01-26  7:40 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 68687, manikulin, emacs-orgmode, stefankangas

> Cc: 68687@debbugs.gnu.org, Max Nikulin <manikulin@gmail.com>,
>  emacs-orgmode@gnu.org
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Thu, 25 Jan 2024 23:43:14 +0000
> 
> However, AFAIU, text/org will fall into "standards tree" in IANA media
> type specification, which means that it MUST be registered, as described
> in https://www.rfc-editor.org/rfc/rfc6838.html#section-3.1
> 
> Registering text/org media type requires syntax spec. We are
> still working on format Org mode syntax specifications. See
> https://list.orgmode.org/orgmode/871rjhha8t.fsf@gmail.com/ and
> https://orgmode.org/worg/org-syntax.html
> 
> The spec is still not fully finalized, so we are not yet initiating the
> registration, as we will need to repeat it again if we decide to make
> further changes (https://www.rfc-editor.org/rfc/rfc6838.html#section-5.5)

I hope the process of finalizing the Org spec and moving to its
registration will not fall between the cracks.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-26  7:23       ` Eli Zaretskii
@ 2024-01-26 10:39         ` Max Nikulin
  2024-01-26 12:22           ` Eli Zaretskii
  2024-01-31 16:30         ` Max Nikulin
  1 sibling, 1 reply; 30+ messages in thread
From: Max Nikulin @ 2024-01-26 10:39 UTC (permalink / raw)
  To: Eli Zaretskii, Stefan Kangas; +Cc: 68687

On 26/01/2024 14:23, Eli Zaretskii wrote:
> I'm not sure the removal of text/x-org in these two hunks is a good
> idea: could it perhaps cause trouble to someone, e.g. if an email
> message is sent from Emacs with this change and read by Emacs without
> it?

I do not mind if you will decide to split the suggested patch into 2 
parts and to postpone for some years hunks that affect sending. Anyway 
it would be a step toward text/org media type.

Messages sent to the emacs-orgmode mailing list last years contain mix of
- text/org
- text/x-org
- application/vnd.lotus-organizer (most popular variant)





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]       ` <87h6j1f08d.fsf@localhost>
  2024-01-26  7:40         ` Eli Zaretskii
@ 2024-01-26 10:52         ` Max Nikulin
       [not found]         ` <86h6j0bl0m.fsf@gnu.org>
                           ` (2 subsequent siblings)
  4 siblings, 0 replies; 30+ messages in thread
From: Max Nikulin @ 2024-01-26 10:52 UTC (permalink / raw)
  To: Ihor Radchenko, Stefan Kangas; +Cc: 68687

On 26/01/2024 06:43, Ihor Radchenko wrote:
> However, AFAIU, text/org will fall into "standards tree" in IANA media
> type specification, which means that it MUST be registered,
> 
> Registering text/org media type requires syntax spec. We are
> still working on format Org mode syntax specifications.

You a right. I was confused reading rfc6648 that registration procedure 
had been simplified to deprecate x- prefixes. In addition, I did not 
realize that application/vnd.lotus-organizer was registered without 
format specification because this type belongs to the vendor tree, not 
standards one.
https://www.iana.org/assignments/media-types/application/vnd.lotus-organizer

I do not think it is reasonable to use a type like text/vnd.gnu.emacs.org.

Even with format specification, I am afraid, .org file name suffix may 
be an obstacle. Likely it is necessary to contact IBM and to ask them 
concerning registration of Lotus. In the optimistic scenario they may 
declare Lotus-related media types as obsolete since the product is 
discontinued.

Changing of file name suffix for Org would be more painful than updating 
emacs to use text/org instead of text/x-org.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-26 10:39         ` Max Nikulin
@ 2024-01-26 12:22           ` Eli Zaretskii
  0 siblings, 0 replies; 30+ messages in thread
From: Eli Zaretskii @ 2024-01-26 12:22 UTC (permalink / raw)
  To: Max Nikulin; +Cc: 68687, stefankangas

> Date: Fri, 26 Jan 2024 17:39:11 +0700
> Cc: 68687@debbugs.gnu.org
> From: Max Nikulin <manikulin@gmail.com>
> 
> On 26/01/2024 14:23, Eli Zaretskii wrote:
> > I'm not sure the removal of text/x-org in these two hunks is a good
> > idea: could it perhaps cause trouble to someone, e.g. if an email
> > message is sent from Emacs with this change and read by Emacs without
> > it?
> 
> I do not mind if you will decide to split the suggested patch into 2 
> parts and to postpone for some years hunks that affect sending. Anyway 
> it would be a step toward text/org media type.
> 
> Messages sent to the emacs-orgmode mailing list last years contain mix of
> - text/org
> - text/x-org
> - application/vnd.lotus-organizer (most popular variant)

So can you please point out which part(s) of your patch should be
installed right away?  Or post a new patch that includes only those
parts?

Thanks.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]         ` <86h6j0bl0m.fsf@gnu.org>
@ 2024-01-26 14:00           ` Ihor Radchenko
  0 siblings, 0 replies; 30+ messages in thread
From: Ihor Radchenko @ 2024-01-26 14:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 68687, manikulin, emacs-orgmode, stefankangas

Eli Zaretskii <eliz@gnu.org> writes:

>> The spec is still not fully finalized, so we are not yet initiating the
>> registration, as we will need to repeat it again if we decide to make
>> further changes (https://www.rfc-editor.org/rfc/rfc6838.html#section-5.5)
>
> I hope the process of finalizing the Org spec and moving to its
> registration will not fall between the cracks.

No worries. We are slowly working on the spec. See
https://git.sr.ht/~bzg/worg/log/master/item/org-syntax.org

But finalizing the whole thing will not be fast, given our plans to
extend Org mode syntax to better suit software manuals as requested by
RMS, and to address several long-standing issues with escaping edge
cases.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-25 23:10     ` Stefan Kangas
                         ` (2 preceding siblings ...)
       [not found]       ` <87h6j1f08d.fsf@localhost>
@ 2024-01-27  3:38       ` Richard Stallman
       [not found]       ` <E1rTZWZ-0008Ca-EM@fencepost.gnu.org>
  4 siblings, 0 replies; 30+ messages in thread
From: Richard Stallman @ 2024-01-27  3:38 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 68687, manikulin, emacs-orgmode

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

What is the purpose for which text/org would be used?
In what situations would we want to send files in Org format
and why would it be useful to formally label them?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]       ` <E1rTZWZ-0008Ca-EM@fencepost.gnu.org>
@ 2024-01-28 16:35         ` Max Nikulin
  2024-01-28 16:47           ` Eli Zaretskii
       [not found]           ` <8634uh5rrq.fsf@gnu.org>
  0 siblings, 2 replies; 30+ messages in thread
From: Max Nikulin @ 2024-01-28 16:35 UTC (permalink / raw)
  To: rms, Stefan Kangas; +Cc: 68687, emacs-orgmode

On 27/01/2024 10:38, Richard Stallman wrote:
> 
> What is the purpose for which text/org would be used?
> In what situations would we want to send files in Org format
> and why would it be useful to formally label them?

I am rather confused by these questions. Media types appears in the 
Content-Type header. Applications decide how to treat content basing on 
media type description. E.g. Thunderbird may be configured to display 
text attachments inline, but if the same attachment uses 
application/vnd.lotus-organizer then an external application must be 
invoked to see its text.

De-facto Org files are used in various projects. Received or fetched Org 
files must be treated with some precautions, but it is another story.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-28 16:35         ` Max Nikulin
@ 2024-01-28 16:47           ` Eli Zaretskii
       [not found]           ` <8634uh5rrq.fsf@gnu.org>
  1 sibling, 0 replies; 30+ messages in thread
From: Eli Zaretskii @ 2024-01-28 16:47 UTC (permalink / raw)
  To: Max Nikulin; +Cc: 68687, emacs-orgmode, rms, stefankangas

> Cc: 68687@debbugs.gnu.org, emacs-orgmode@gnu.org
> Date: Sun, 28 Jan 2024 23:35:09 +0700
> From: Max Nikulin <manikulin@gmail.com>
> 
> On 27/01/2024 10:38, Richard Stallman wrote:
> > 
> > What is the purpose for which text/org would be used?
> > In what situations would we want to send files in Org format
> > and why would it be useful to formally label them?
> 
> I am rather confused by these questions. Media types appears in the 
> Content-Type header. Applications decide how to treat content basing on 
> media type description. E.g. Thunderbird may be configured to display 
> text attachments inline, but if the same attachment uses 
> application/vnd.lotus-organizer then an external application must be 
> invoked to see its text.
> 
> De-facto Org files are used in various projects. Received or fetched Org 
> files must be treated with some precautions, but it is another story.

I think Richard lacks the broader context: that text/org is supposed
to appear in the Content-Type header in email messages, and the MUA is
supposed to display this content in received email messages according
to user expectations, which generally follow how Org buffers display
text.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]           ` <8634uh5rrq.fsf@gnu.org>
@ 2024-01-30  3:56             ` Richard Stallman
       [not found]             ` <E1rUfF4-00069N-Gu@fencepost.gnu.org>
  1 sibling, 0 replies; 30+ messages in thread
From: Richard Stallman @ 2024-01-30  3:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 68687, manikulin, emacs-orgmode, stefankangas

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > I think Richard lacks the broader context: that text/org is supposed
  > to appear in the Content-Type header in email messages, and the MUA is
  > supposed to display this content in received email messages according
  > to user expectations, which generally follow how Org buffers display
  > text.

Thanks/ I had a feeling that it was something along roughtly those
lines, but I was not sure.  Now I know.

I am concerned that the actions described above would tend to embed
Org format and Org mode more deeply into Emacs usage.

Suppose A and B are Org users.  If A knows this, and mails B a message
which contains text labaled as text/org, that won't make anyone
unhappy.  No one would have a reason to complain.

But what if C mails a message to D with text labeled as text/org and D
is not an Org user?  Will that cause Emacs to load Org?  It should
not.

What will Gnus do when the user readss a message with text labaled as
text/org?  What will Rmail do?  What will MH-E do?

These are crucial questions because the answers would determine
whether this feature pressures people to use Org mode or not.  We need
concrete answers because only that would enable us to see cleary now
whether the feature would do that if in use.

Max Nikulin <manikulin@gmail.com> wrote:

    Received or fetched Org 
  > files must be treated with some precautions, but it is another story.

I was not aware of this issue.  Let's look at it concretely now so we
can determine what its implications are.  Have people already written
a list of these precautions?  If so, I'd like to see it.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]             ` <E1rUfF4-00069N-Gu@fencepost.gnu.org>
@ 2024-01-30 12:13               ` Ihor Radchenko
  2024-01-30 17:12                 ` bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type) Mike Kupfer
                                   ` (4 more replies)
  2024-01-30 12:52               ` Eli Zaretskii
  1 sibling, 5 replies; 30+ messages in thread
From: Ihor Radchenko @ 2024-01-30 12:13 UTC (permalink / raw)
  To: rms; +Cc: 68687, Eli Zaretskii, emacs-orgmode, manikulin, stefankangas

Richard Stallman <rms@gnu.org> writes:

> I am concerned that the actions described above would tend to embed
> Org format and Org mode more deeply into Emacs usage.
>
> Suppose A and B are Org users.  If A knows this, and mails B a message
> which contains text labaled as text/org, that won't make anyone
> unhappy.  No one would have a reason to complain.
>
> But what if C mails a message to D with text labeled as text/org and D
> is not an Org user?  Will that cause Emacs to load Org?  It should
> not.

> What will Gnus do when the user readss a message with text labaled as
> text/org?  What will Rmail do?  What will MH-E do?

It may or may not depending on user customization `mm-inline-media-tests'.
Just like with text/html, application/javascript, text/x-sh, images,
etc.

By default, for example, text/html gets rendered via shr.el (AFAIK). Do
you think that shr.el should not be loaded (in (require 'shr) sense)?

> These are crucial questions because the answers would determine
> whether this feature pressures people to use Org mode or not.  We need
> concrete answers because only that would enable us to see cleary now
> whether the feature would do that if in use.

Even when text/org is rendered using Org mode, there is nothing
pressuring people to use Org mode there. It is just visuals. Org major
mode is not activated.

Also, it is already what Emacs does for text/x-org. This patch is merely
asking to treat text/org as text/x-org is already treated.

> Max Nikulin <manikulin@gmail.com> wrote:
>
>     Received or fetched Org 
>   > files must be treated with some precautions, but it is another story.
>
> I was not aware of this issue.  Let's look at it concretely now so we
> can determine what its implications are.  Have people already written
> a list of these precautions?  If so, I'd like to see it.

Max is referring to various security issues with evaluating code inside
Org mode buffers. They are known, but not relevant to Org text being
displayed in email MUA - Org never evaluates any code automatically
without user explicitly asking for it. And in MUA, Org mode is simply
used to apply faces. No other interaction with the displayed text/org
mime part is allowed.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]             ` <E1rUfF4-00069N-Gu@fencepost.gnu.org>
  2024-01-30 12:13               ` Ihor Radchenko
@ 2024-01-30 12:52               ` Eli Zaretskii
  1 sibling, 0 replies; 30+ messages in thread
From: Eli Zaretskii @ 2024-01-30 12:52 UTC (permalink / raw)
  To: rms; +Cc: 68687, manikulin, emacs-orgmode, stefankangas

> From: Richard Stallman <rms@gnu.org>
> Cc: manikulin@gmail.com, 68687@debbugs.gnu.org, emacs-orgmode@gnu.org,
> 	stefankangas@gmail.com
> Date: Mon, 29 Jan 2024 22:56:58 -0500
> 
> I am concerned that the actions described above would tend to embed
> Org format and Org mode more deeply into Emacs usage.
> 
> Suppose A and B are Org users.  If A knows this, and mails B a message
> which contains text labaled as text/org, that won't make anyone
> unhappy.  No one would have a reason to complain.
> 
> But what if C mails a message to D with text labeled as text/org and D
> is not an Org user?  Will that cause Emacs to load Org?  It should
> not.
> 
> What will Gnus do when the user readss a message with text labaled as
> text/org?  What will Rmail do?  What will MH-E do?

This happens to me all the time (because our mailing lists are full of
such C's, and I'm one example of D), so I know what happens, at least
in Rmail: you see the text with Org markup uninterpreted, as plain
text.  Here's a random example:

  #+begin_src emacs-lisp
  (add-hook 'before-save-hook 'time-stamp)
  (require 'org-refile)
  (setq org-refile-use-cache t)
  (setq org-refile-use-outline-path t)
  (setq org-refile-targets '((nil :maxlevel . 5)))
  (setq org-goto-interface 'outline-path-completion)
  (setq large-file-warning-threshold 15000000)
  (find-file "foo.org")
  (org-refile-get-targets)
  #+end_src

With Org, the header and footer should be removed from display, and
the Lisp code should be displayed with lisp-mode fontifications.  What
I see is just plain text, including the pesky header and footer.

It isn't a catastrophe, IMO.

> These are crucial questions because the answers would determine
> whether this feature pressures people to use Org mode or not.  We need
> concrete answers because only that would enable us to see cleary now
> whether the feature would do that if in use.

In any case, we already have this in the wild, it just uses
Content-type that current standards frown on.  This proposal is just
to use a different, more standard-compliant Content-type.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type)
  2024-01-30 12:13               ` Ihor Radchenko
@ 2024-01-30 17:12                 ` Mike Kupfer
  2024-01-30 17:51                   ` Ihor Radchenko
       [not found]                   ` <87mssmvhdw.fsf@localhost>
  2024-01-31 16:18                 ` bug#68687: [PATCH] Use text/org media type Max Nikulin
                                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 30+ messages in thread
From: Mike Kupfer @ 2024-01-30 17:12 UTC (permalink / raw)
  To: Ihor Radchenko
  Cc: rms, 68687, emacs-orgmode, stefankangas, Eli Zaretskii, manikulin

Ihor Radchenko wrote:

> Max is referring to various security issues with evaluating code inside
> Org mode buffers. They are known, but not relevant to Org text being
> displayed in email MUA - Org never evaluates any code automatically
> without user explicitly asking for it. And in MUA, Org mode is simply
> used to apply faces. No other interaction with the displayed text/org
> mime part is allowed.

I can believe that Org text snippets are safe in an email MUA.  

But in the general case, I don't think Org mode is quite as safe as you
implied.  The last I heard, conversion from Org mode to another format
(e.g., plain text or HTML) can result in code evaluation, without the
user authorizing it (see
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=48676).  I would not
expect random users to understand that format conversion is a
potentially risky operation.

mike





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type)
  2024-01-30 17:12                 ` bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type) Mike Kupfer
@ 2024-01-30 17:51                   ` Ihor Radchenko
       [not found]                   ` <87mssmvhdw.fsf@localhost>
  1 sibling, 0 replies; 30+ messages in thread
From: Ihor Radchenko @ 2024-01-30 17:51 UTC (permalink / raw)
  To: Mike Kupfer
  Cc: rms, 68687, emacs-orgmode, stefankangas, Eli Zaretskii, manikulin

Mike Kupfer <kupfer@rawbw.com> writes:

> I can believe that Org text snippets are safe in an email MUA.  

That's exactly what I wanted to emphasize.

> But in the general case, I don't think Org mode is quite as safe as you
> implied.

I did not imply that Org mode is safe. I directly said that there are
security issues and that they are known.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]       ` <87h6j1f08d.fsf@localhost>
                           ` (2 preceding siblings ...)
       [not found]         ` <86h6j0bl0m.fsf@gnu.org>
@ 2024-01-30 19:39         ` Stefan Kangas
       [not found]         ` <CADwFkm=9EwTZwa3F4wGJVPAVgcW4KXS1kPzXLPg1msYDjJL2cw@mail.gmail.com>
  4 siblings, 0 replies; 30+ messages in thread
From: Stefan Kangas @ 2024-01-30 19:39 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 68687, Max Nikulin, emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> I see using text/org as an improvement. text/x-org is likely useless.
> At least,
> https://github.com/jeremy-compostella/org-msg/blob/master/org-msg.el
> uses text/org, which may appear in email parts.
>
> However, AFAIU, text/org will fall into "standards tree" in IANA media
> type specification, which means that it MUST be registered, as described
> in https://www.rfc-editor.org/rfc/rfc6838.html#section-3.1
>
> Registering text/org media type requires syntax spec. We are
> still working on format Org mode syntax specifications. See
> https://list.orgmode.org/orgmode/871rjhha8t.fsf@gmail.com/ and
> https://orgmode.org/worg/org-syntax.html
>
> The spec is still not fully finalized, so we are not yet initiating the
> registration, as we will need to repeat it again if we decide to make
> further changes (https://www.rfc-editor.org/rfc/rfc6838.html#section-5.5)

What does this mean with regards to the patch?  Should we wait with
installing it until that process is done?





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]         ` <CADwFkm=9EwTZwa3F4wGJVPAVgcW4KXS1kPzXLPg1msYDjJL2cw@mail.gmail.com>
@ 2024-01-30 20:34           ` Ihor Radchenko
  0 siblings, 0 replies; 30+ messages in thread
From: Ihor Radchenko @ 2024-01-30 20:34 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 68687, Max Nikulin, emacs-orgmode

Stefan Kangas <stefankangas@gmail.com> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> I see using text/org as an improvement. text/x-org is likely useless.
>> At least,
>> https://github.com/jeremy-compostella/org-msg/blob/master/org-msg.el
>> uses text/org, which may appear in email parts.
> ...
> What does this mean with regards to the patch?  Should we wait with
> installing it until that process is done?

I see no reason to wait.
We already have people sending text/org in emails. Recognizing mime
parts marked as text/org as we already do for text/x-org will be a
clear improvement.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-30 12:13               ` Ihor Radchenko
  2024-01-30 17:12                 ` bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type) Mike Kupfer
@ 2024-01-31 16:18                 ` Max Nikulin
       [not found]                 ` <3c8e8b77-77d1-4522-85d5-5cce2cc020ca@gmail.com>
                                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 30+ messages in thread
From: Max Nikulin @ 2024-01-31 16:18 UTC (permalink / raw)
  To: Ihor Radchenko, rms; +Cc: 68687, Eli Zaretskii, emacs-orgmode, stefankangas

On 30/01/2024 19:13, Ihor Radchenko wrote:
> Even when text/org is rendered using Org mode, there is nothing
> pressuring people to use Org mode there. It is just visuals. Org major
> mode is not activated.

I am not familiar with gnus & Co code, so I am confused by (funcall 
mode) in `mm-display-inline-fontify'. Doesn't it activate the major mode 
through `mm-display-org-inline'?

On the other hand, I am afraid, changing `mm-inline-media-tests' to use

("text/org" mm-inline-text identity)
("text/x-org" mm-inline-text identity)

by default instead of `mm-display-org-inline' for safety and to avoid 
loading of Org mode will cause a lot of complains from Org users.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-26  7:23       ` Eli Zaretskii
  2024-01-26 10:39         ` Max Nikulin
@ 2024-01-31 16:30         ` Max Nikulin
  1 sibling, 0 replies; 30+ messages in thread
From: Max Nikulin @ 2024-01-31 16:30 UTC (permalink / raw)
  To: Eli Zaretskii, Stefan Kangas; +Cc: 68687, emacs-orgmode

On 26/01/2024 14:23, Eli Zaretskii wrote:
>> Max Nikulin writes:
> 
>>> 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"))
> 
> I'm not sure the removal of text/x-org in these two hunks is a good
> idea: could it perhaps cause trouble to someone, e.g. if an email
> message is sent from Emacs with this change and read by Emacs without
> it?

Changing of `mm-display-org-inline' may be postponed. I am curious 
however if there are a lot of users overriding their /etc/mime.types to 
avoid application/vnd.lotus-organizer.

However I am unsure whether `mm-uu-org-src-code-block-extract' is used 
to send messages. If it purpose to decode received messages then the 
change should be safe. I had a hope to receive some comments from 
developers familiar with Emacs mail clients.

I have realized that I missed `mm-automatic-display' there "text/org" 
should be added similar to `mm-inline-media-tests'.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]                 ` <3c8e8b77-77d1-4522-85d5-5cce2cc020ca@gmail.com>
@ 2024-01-31 16:32                   ` Ihor Radchenko
  0 siblings, 0 replies; 30+ messages in thread
From: Ihor Radchenko @ 2024-01-31 16:32 UTC (permalink / raw)
  To: Max Nikulin; +Cc: 68687, Eli Zaretskii, emacs-orgmode, rms, stefankangas

Max Nikulin <manikulin@gmail.com> writes:

> On 30/01/2024 19:13, Ihor Radchenko wrote:
>> Even when text/org is rendered using Org mode, there is nothing
>> pressuring people to use Org mode there. It is just visuals. Org major
>> mode is not activated.
>
> I am not familiar with gnus & Co code, so I am confused by (funcall 
> mode) in `mm-display-inline-fontify'. Doesn't it activate the major mode 
> through `mm-display-org-inline'?

It creates temporary buffer, activates Org mode there, and copies back
the fontified text for display inside message.
I do not know about any security issues when one merely opens Org file
without actually executing Org mode commands.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-24 14:43   ` bug#68687: [PATCH] Use text/org media type Max Nikulin
  2024-01-25 23:10     ` Stefan Kangas
@ 2024-01-31 20:00     ` Stefan Kangas
  2024-02-01 10:40       ` Max Nikulin
  1 sibling, 1 reply; 30+ messages in thread
From: Stefan Kangas @ 2024-01-31 20:00 UTC (permalink / raw)
  To: Max Nikulin, 68687; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> From 8b71393625f11590e99896808bbd04ed83f7917e Mon Sep 17 00:00:00 2001
> From: Max Nikulin <manikulin@gmail.com>
> 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/6d94fff4-4d30-4121-bfd1-f267cb5b637c@gmail.com
> ---
>  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"))

It's been many moons since I last looked at email attachements in any
detail, so I have some questions.

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?  IOW, I'm asking if it is backwards-compatible to remove
"text/org", in either direction.  Will .org files be displayed in the
same way as before or not on both new and old versions?

I've noticed on my machine that .org files have been interpreted as
application/vnd.lotus-organizer.  Presumably that's due to some local
configuration in /etc/mime.types on my distro.  Is that correct?  Is it
documented somewhere how to override that system configuration in Emacs?

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.  On the off
chance that someone is opening such files from Emacs, they could just
revert that locally.  WDYT?

>    "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





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-31 20:00     ` Stefan Kangas
@ 2024-02-01 10:40       ` Max Nikulin
  2024-02-02  7:09         ` Stefan Kangas
       [not found]         ` <CADwFkmknBZj0Y4H=Nwqa4sH0uQAsP70kWtMU33ZgfRiuWkX9_w@mail.gmail.com>
  0 siblings, 2 replies; 30+ messages in thread
From: Max Nikulin @ 2024-02-01 10:40 UTC (permalink / raw)
  To: Stefan Kangas, 68687; +Cc: emacs-orgmode

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.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type)
       [not found]                   ` <87mssmvhdw.fsf@localhost>
@ 2024-02-02  3:38                     ` Richard Stallman
  2024-02-02  4:58                       ` bug#68687: Org mode code evaluation Max Nikulin
  0 siblings, 1 reply; 30+ messages in thread
From: Richard Stallman @ 2024-02-02  3:38 UTC (permalink / raw)
  To: Ihor Radchenko
  Cc: 68687, emacs-orgmode, stefankangas, eliz, manikulin, kupfer

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > I did not imply that Org mode is safe. I directly said that there are
  > security issues and that they are known.

Could you plesae post a pointer to a desciption of them?
-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-01-30 12:13               ` Ihor Radchenko
                                   ` (2 preceding siblings ...)
       [not found]                 ` <3c8e8b77-77d1-4522-85d5-5cce2cc020ca@gmail.com>
@ 2024-02-02  3:40                 ` Richard Stallman
       [not found]                 ` <E1rVkPO-0008LA-RN@fencepost.gnu.org>
  4 siblings, 0 replies; 30+ messages in thread
From: Richard Stallman @ 2024-02-02  3:40 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 68687, eliz, emacs-orgmode, manikulin, stefankangas

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > It may or may not depending on user customization `mm-inline-media-tests'.
  > Just like with text/html, application/javascript, text/x-sh, images,
  > etc.

I looked at the definition of that option, and at the function
`mm-display-inline-fontify' that it calls.  That function is
nontrivial, so I can't tell, in a short time, what it does and doesn't
do.

  > Even when text/org is rendered using Org mode, there is nothing
  > pressuring people to use Org mode there. It is just visuals. Org major
  > mode is not activated.

That is one good thing.  Maybe that means it's fine.

But you've told me little about what things `mm-display-inline-fontify' does,
only that they do not include selecting Org mode.

Could you please tell me the main things it _does_ do?

  > Max is referring to various security issues with evaluating code inside
  > Org mode buffers. They are known, but not relevant to Org text being
  > displayed in email MUA - Org never evaluates any code automatically
  > without user explicitly asking for it.

I understand now.  I agree, that is not an issue for this specific point.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: Org mode code evaluation
  2024-02-02  3:38                     ` Richard Stallman
@ 2024-02-02  4:58                       ` Max Nikulin
  0 siblings, 0 replies; 30+ messages in thread
From: Max Nikulin @ 2024-02-02  4:58 UTC (permalink / raw)
  To: rms, Ihor Radchenko; +Cc: 68687, eliz, emacs-orgmode, kupfer, stefankangas

On 02/02/2024 10:38, Richard Stallman wrote:
> 
>    > I did not imply that Org mode is safe. I directly said that there are
>    > security issues and that they are known.
> 
> Could you plesae post a pointer to a desciption of them?

I would strongly prefer to move discussion of Org security to a 
dedicated thread on emacs-orgmode or emacs-devel and leave this bug to 
media types used for Org.

Whenever the suggested patch committed (as a whole or in parts) or not, 
admit that Org mode is already used as media type handler for mail 
messages and downloaded files.

I have tried a couple more ideas, but have not managed to achieve code 
execution when files are loaded (assuming default or plausible user 
settings). If Org keystrokes are not active when mail messages are 
opened then it should be safe enough. (However I suspect an issue 
unrelated to code execution.) If Emacs or Org mode has severe issues 
then it is possible to exploit them even without the patch. Just send a 
message having 3 attachments covering all variants of Content-Type.

The point is to minimize discrepancy related to Org mode stuff within 
Emacs and outside of it. E.g. in default configuration Thunderbird on 
Debian 12 bookworm sends attachments as text/org. Emacs core uses 
text/x-org or application/vnd.lotus-organizer. With no action taken it 
will last further.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
  2024-02-01 10:40       ` Max Nikulin
@ 2024-02-02  7:09         ` Stefan Kangas
       [not found]         ` <CADwFkmknBZj0Y4H=Nwqa4sH0uQAsP70kWtMU33ZgfRiuWkX9_w@mail.gmail.com>
  1 sibling, 0 replies; 30+ messages in thread
From: Stefan Kangas @ 2024-02-02  7:09 UTC (permalink / raw)
  To: Max Nikulin, 68687; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> 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"))
>
> 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.

So old mailers will still use "Content-Type: text/x-org", and it is
therefore premature to remove that entry.

I'm not sure about the urgency in starting to send out "text/org" at
this stage.  It will just lead to old versions of Emacs displaying org
attachments incorrectly in more cases, I think?

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

?

In Emacs <29, perhaps Org mode could update the relevant variables to
include "text/org", too?

>> 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.

Is that documented somewhere in our documentation?

>> 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.

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.

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





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH] Use text/org media type
       [not found]                 ` <E1rVkPO-0008LA-RN@fencepost.gnu.org>
@ 2024-02-02  7:15                   ` Eli Zaretskii
  0 siblings, 0 replies; 30+ messages in thread
From: Eli Zaretskii @ 2024-02-02  7:15 UTC (permalink / raw)
  To: rms; +Cc: 68687, yantar92, emacs-orgmode, manikulin, stefankangas

> From: Richard Stallman <rms@gnu.org>
> Cc: eliz@gnu.org, manikulin@gmail.com, 68687@debbugs.gnu.org,
> 	emacs-orgmode@gnu.org, stefankangas@gmail.com
> Date: Thu, 01 Feb 2024 22:40:06 -0500
> 
>   > It may or may not depending on user customization `mm-inline-media-tests'.
>   > Just like with text/html, application/javascript, text/x-sh, images,
>   > etc.
> 
> I looked at the definition of that option, and at the function
> `mm-display-inline-fontify' that it calls.  That function is
> nontrivial, so I can't tell, in a short time, what it does and doesn't
> do.

AFAIU, that function copies a portion of buffer text to a temporary
buffer, determines the correct major-mode for that text, then invokes
that major-mode and fontifies the text according to that mode, and
finally copies the fontified text back into the original buffer.





^ permalink raw reply	[flat|nested] 30+ messages in thread

* bug#68687: [PATCH v2] Use text/org media type
       [not found]         ` <CADwFkmknBZj0Y4H=Nwqa4sH0uQAsP70kWtMU33ZgfRiuWkX9_w@mail.gmail.com>
@ 2024-02-02 16:28           ` Max Nikulin
  0 siblings, 0 replies; 30+ messages in thread
From: Max Nikulin @ 2024-02-02 16:28 UTC (permalink / raw)
  To: Stefan Kangas, 68687; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1890 bytes --]

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.

[-- Attachment #2: v2-0001-Use-text-org-media-type.patch --]
[-- Type: text/x-patch, Size: 2833 bytes --]

From 9f0950075bbfbfc1ff1080ee410c66e1953197d7 Mon Sep 17 00:00:00 2001
From: Max Nikulin <manikulin@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-f267cb5b637c@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


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2024-02-02 16:28 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <6d94fff4-4d30-4121-bfd1-f267cb5b637c@gmail.com>
     [not found] ` <8734uqpvgn.fsf@tec.tecosaur.net>
2024-01-24 14:43   ` bug#68687: [PATCH] Use text/org media type Max Nikulin
2024-01-25 23:10     ` Stefan Kangas
2024-01-25 23:43       ` Ihor Radchenko
2024-01-26  7:23       ` Eli Zaretskii
2024-01-26 10:39         ` Max Nikulin
2024-01-26 12:22           ` Eli Zaretskii
2024-01-31 16:30         ` Max Nikulin
     [not found]       ` <87h6j1f08d.fsf@localhost>
2024-01-26  7:40         ` Eli Zaretskii
2024-01-26 10:52         ` Max Nikulin
     [not found]         ` <86h6j0bl0m.fsf@gnu.org>
2024-01-26 14:00           ` Ihor Radchenko
2024-01-30 19:39         ` Stefan Kangas
     [not found]         ` <CADwFkm=9EwTZwa3F4wGJVPAVgcW4KXS1kPzXLPg1msYDjJL2cw@mail.gmail.com>
2024-01-30 20:34           ` Ihor Radchenko
2024-01-27  3:38       ` Richard Stallman
     [not found]       ` <E1rTZWZ-0008Ca-EM@fencepost.gnu.org>
2024-01-28 16:35         ` Max Nikulin
2024-01-28 16:47           ` Eli Zaretskii
     [not found]           ` <8634uh5rrq.fsf@gnu.org>
2024-01-30  3:56             ` Richard Stallman
     [not found]             ` <E1rUfF4-00069N-Gu@fencepost.gnu.org>
2024-01-30 12:13               ` Ihor Radchenko
2024-01-30 17:12                 ` bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type) Mike Kupfer
2024-01-30 17:51                   ` Ihor Radchenko
     [not found]                   ` <87mssmvhdw.fsf@localhost>
2024-02-02  3:38                     ` Richard Stallman
2024-02-02  4:58                       ` bug#68687: Org mode code evaluation Max Nikulin
2024-01-31 16:18                 ` bug#68687: [PATCH] Use text/org media type Max Nikulin
     [not found]                 ` <3c8e8b77-77d1-4522-85d5-5cce2cc020ca@gmail.com>
2024-01-31 16:32                   ` Ihor Radchenko
2024-02-02  3:40                 ` Richard Stallman
     [not found]                 ` <E1rVkPO-0008LA-RN@fencepost.gnu.org>
2024-02-02  7:15                   ` Eli Zaretskii
2024-01-30 12:52               ` Eli Zaretskii
2024-01-31 20:00     ` Stefan Kangas
2024-02-01 10:40       ` Max Nikulin
2024-02-02  7:09         ` Stefan Kangas
     [not found]         ` <CADwFkmknBZj0Y4H=Nwqa4sH0uQAsP70kWtMU33ZgfRiuWkX9_w@mail.gmail.com>
2024-02-02 16:28           ` bug#68687: [PATCH v2] " Max Nikulin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).