Re: bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type)

2024-02-02 Thread Ihor Radchenko
[ dropping debbugs from the loop ]

Richard Stallman  writes:

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

https://list.orgmode.org/orgmode/u2qqki$25r$1...@ciao.gmane.io/
https://yhetil.org/emacs-bugs/2nk0nl7asb@fencepost.gnu.org/
https://list.orgmode.org/orgmode/tjct9e$179u$1...@ciao.gmane.io/
https://list.orgmode.org/orgmode/87edsd5o89.fsf@localhost/

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



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

2024-02-01 Thread Eli Zaretskii
> From: Richard Stallman 
> Cc: e...@gnu.org, maniku...@gmail.com, 68...@debbugs.gnu.org,
>   emacs-orgmode@gnu.org, stefankan...@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.



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

2024-02-01 Thread Stefan Kangas
Max Nikulin  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?



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

2024-02-01 Thread Richard Stallman
[[[ 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)





Re: bug#68687: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type)

2024-02-01 Thread Richard Stallman
[[[ 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)





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

2024-02-01 Thread Max Nikulin

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.




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

2024-01-31 Thread Stefan Kangas
Max Nikulin  writes:

> From 8b71393625f11590e99896808bbd04ed83f7917e Mon Sep 17 00:00:00 2001
> From: Max Nikulin 
> 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
> 
>
> 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 | 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



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

2024-01-31 Thread Max Nikulin

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




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

2024-01-31 Thread Ihor Radchenko
Max Nikulin  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 .
Support Org development at ,
or support my work at 



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

2024-01-31 Thread Max Nikulin

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.




Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type)

2024-01-31 Thread Mike Kupfer
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



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

2024-01-30 Thread Ihor Radchenko
Stefan Kangas  writes:

> Ihor Radchenko  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 .
Support Org development at ,
or support my work at 



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

2024-01-30 Thread Stefan Kangas
Ihor Radchenko  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@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?



Re: Org mode code evaluation (was: bug#68687: [PATCH] Use text/org media type)

2024-01-30 Thread Ihor Radchenko
Mike Kupfer  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 .
Support Org development at ,
or support my work at 



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

2024-01-30 Thread Eli Zaretskii
> From: Richard Stallman 
> Cc: maniku...@gmail.com, 68...@debbugs.gnu.org, emacs-orgmode@gnu.org,
>   stefankan...@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 1500)
  (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.



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

2024-01-30 Thread Ihor Radchenko
Richard Stallman  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  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 .
Support Org development at ,
or support my work at 



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

2024-01-29 Thread Richard Stallman
[[[ 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  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)





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

2024-01-28 Thread Eli Zaretskii
> Cc: 68...@debbugs.gnu.org, emacs-orgmode@gnu.org
> Date: Sun, 28 Jan 2024 23:35:09 +0700
> From: Max Nikulin 
> 
> 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.



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

2024-01-28 Thread Max Nikulin

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.




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

2024-01-26 Thread Richard Stallman
[[[ 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)





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

2024-01-26 Thread Ihor Radchenko
Eli Zaretskii  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 .
Support Org development at ,
or support my work at 



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

2024-01-25 Thread Eli Zaretskii
> Cc: 68...@debbugs.gnu.org, Max Nikulin ,
>  emacs-orgmode@gnu.org
> From: Ihor Radchenko 
> Date: Thu, 25 Jan 2024 23:43:14 +
> 
> 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@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.



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

2024-01-25 Thread Eli Zaretskii
> Cc: emacs-orgmode@gnu.org
> From: Stefan Kangas 
> Date: Thu, 25 Jan 2024 15:10:27 -0800
> 
> Max Nikulin  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.



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

2024-01-25 Thread Ihor Radchenko
Stefan Kangas  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@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 .
Support Org development at ,
or support my work at 



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

2024-01-25 Thread Stefan Kangas
Max Nikulin  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-f267cb5b6...@gmail.com
> From 8b71393625f11590e99896808bbd04ed83f7917e Mon Sep 17 00:00:00 2001
> From: Max Nikulin 
> 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
> 
>
> 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 | 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



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

2024-01-24 Thread Max Nikulin

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-f267cb5b6...@gmail.com
From 8b71393625f11590e99896808bbd04ed83f7917e Mon Sep 17 00:00:00 2001
From: Max Nikulin 
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


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