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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 20 Jan 2025 15:13:46 +0200

> Date: Mon, 20 Jan 2025 11:33:55 +0100
> Cc: [email-masked]
> From: Alexey Lebedeff <[email-masked]>
> 
> On 23-11-2024 14:12, Eli Zaretskii wrote:
> >> Date: Thu, 21 Nov 2024 18:53:21 +0000
> >> From:  Alexey Lebedeff via "Bug reports for GNU Emacs,
> >>   the Swiss army knife of text editors" <[email-masked]>
> >>
> >> The change introduced by
> >> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65469 doesn't work anymore
> >> in 'generic' desktop environment (as detected by 'xdg-open').
> >>
> >> I assume it works in some desktop environments, where `xdg-open`
> >> delegates opening to the desktop environment itself. But there is also a
> >> `generic` version, which tries to implent XDG specification itself.
> >>
> >> On 2023-10-03 there was a change introduced in xdg-utils
> >> https://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=b9d3ecf8180c57dbb5ca47253898ba0553e81c60
> >> to more strictly follow xdg specification, and only pass URL-like
> >> arguments to programs that explicitly requested this by using '%u' or
> >> '%U' parameters.
> >>
> >> 'etc/emacsclient.desktop' uses '%F' parameter, which should be used for
> >> programs that do not understand the URL syntax
> >> (https://specifications.freedesktop.org/desktop-entry-spec/latest/exec-variables.html
> >> - section about '%f', but also applies to '%F').
> >>
> >> "x-scheme-handler/org-protocol" is the only URL-like protocol that's
> >> mentioned in the 'etc/emacsclient.desktop', but 'xdg-open' refuses to
> >> use it.
> >>
> >> Just changing '%F' to '%U' in 'etc/emacsclient.desktop' is not possible,
> >> as it allows 'xdg-open' to pass local files as "file:/" URL's if it
> >> wants to.
> >>
> >> 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?
> >
> > (Each time such issues pop up, I regret again that we agreed to
> > include these *.desktop files in our source tree, sigh.)
> 
> Understandable. But I think it's still better than letting users to 
> figure out all the quirks on their own.

To clarify: I think this is for distros to figure out, not for users.

> Since then I've tried to set-up org-protocol on a Windows machine, and 
> the experience was even worse: a few registry edits, and a custom binary 
> (https://github.com/coldacid/org-protocol-w32-handler) to fix encoding 
> issues. OK, I can do it myself, but maybe it's better to do it as a part 
> of the binary distribution - especially given that org-mode is a part of 
> Emacs now.

See above: doing this as part of the binary distribution is perfectly
fine by me.  I just don't think it's our job as the upstream project,
because it requires too intimate knowledge of the various desktops and
their idiosyncrasies.