Subject: bug#74467: 31.0.50; org-protocol emacsclient.desktop change is not fully functional

From: Björn Bidar <[email-masked]>
Date: Mon, 16 Dec 2024 23:07:26 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Ihor Radchenko <[email-masked]>
>> Cc: Alexey Lebedeff <[email-masked]>, [email-masked]
>> Date: Mon, 16 Dec 2024 19:34:01 +0000
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> >> One solution would be introducing separate  .desktop file
>> >> (i.e. 'etc/emacsclient-org-protocol.desktop'), analoguous to the already
>> >> existing 'etc/emacsclient-mail.desktop' (which uses '%u').
>> >
>> > Ihor, could you please look into this?
>> 
>> I am attaching an *untested* patch that implements a new .desktop file.
>
> Thanks.  Let's see if someone objects.
>
>> Note that an alternative could be handling file:// URIs by Emacs. Your call.
>
> I thought we already did?

Not really if I open Emacs with a file uri such as
file:///home/bidar/test.sh /home/bidar/home/bidar/test.sh will be
opened.

Would it be possible to call file-name-handlers if a path starts with
'$uri-name://' for the files passed to Emacs or Emacsclient?

>> > (Each time such issues pop up, I regret again that we agreed to
>> > include these *.desktop files in our source tree, sigh.)
>> 
>> We are obliged to cooperate with other parts of GNU toolchain, don't we?
>
> To some extent, yes.  This one goes waaaay beyond that.  I don't
> understand why Emacs must come with these files, instead of the
> desktop folks developing and keeping them up to date.  There's nothing
> specific to Emacs in these files, just a lot of XDG and shell
> trickery.

No application I have seen so far does require shell trickery in their
desktop files. Most of one or two desktop files with some metadata and
the commands to call and that's it.

It would be easier for Emacs to follow closer to the standard instead
asking for separate implementations. I don't know how this could get any
simpler. Maybe some scripts to generate desktop files for Emacs
packages if there is no for separate desktop files per modes e.g. a
desktop file for Gnus or Info mode.