Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping

From: Björn Bidar <[email-masked]>
Date: Sat, 16 Sep 2023 18:54:23 +0300

Eli Zaretskii <[email-masked]> writes:

>> From: Björn Bidar <[email-masked]>
>> Cc: Jim Porter <[email-masked]>,  [email-masked],
>>   [email-masked],  [email-masked]
>> Date: Sat, 16 Sep 2023 16:43:20 +0300
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> > People might agree, but I don't.  Please consider the perspective.
>> > This started as an obscure and rare problem in a desktop file (which
>> > we provided solely out of good will, since it really isn't our job to
>> > do so, it's the job of downstream distros).
>> 
>> Programs ship their own desktop files.
>
> Programs are shipped by distros.  Emacs as a project does not ship
> anything, we just release the sources in a form that makes building
> Emacs easy.  Our source tarballs cannot be installed, so they are not
> a finished, ready-to-use product.  Distros, by contrast, do ship
> programs ready to be used.
>

Ship source or programs the difference is in semantics.

>> It is not the job of the downstream to provide desktop files unless
>> it is because of a patch from said downstream.
>> 
>> In any case it doesn't make sense for each downstream to ship their own
>> desktop file and fix their own.
>
> I disagree.  Desktop files are specific to the target OS, but Emacs as
> the project does not target any specific OS (although there are OSes
> that we treat more favorably when considering features).  The know-how
> about what exactly is needed for the desktop integration is also
> something that the distros have and we don't, except by chance.

Emacs contains many files specific to operating system or shared by
operating systems (in the case of desktop files mostly about different Linux
distributions that share 90% of their specific attributes).

But again it's about semantics, if it really was about not having any
operating specific parts in Emacs than why is there Windows or macOS
specific functions in Emacs.

> Each distro targets a single OS, and so it is reasonable to expect
> them to arrange for the necessary desktop integration.  For example,
> no one would expect us to provide desktop shortcuts for MS-Windows,
> except as a sign of good will and when we have the necessary expertise
> on board.

Emacs has operating specific code, for Windows or macOS even in low
level interfaces and not just lisp code or accessories such as desktop shortcuts.

Each distribution complies with XDG, all desktop file are XDG compliant.
Emacs has desktop files that work with all distributions be it Linux or BSD.

>> >From my pov letting Emacs do all work in passing arguments is the best
>> solution as escaping is error prone. I haven't seen any program besides
>> Emacs using escaped shell syntax to pass the escaped syntax of their
>> target language. Most just have options to pass the target file or deal
>> with the dbus activation/interface.
>
> We don't require any escapes except those needed by Lisp.
>
> Note that in this case, at least some of the escapes are because the
> desktop shortcut invokes emacsclient via "sh -c "COMMAND STRING",
> something that should be considered an Emacs problem or a problem we
> must solve.

I agree. In the desktop files it is assumed that X11 is used (check for
DISPLAY variable to be set) which breaks (native) Wayland usage, but
that is another issue.