Subject: Re: bug#65469: [PATCH] * etc/emacsclient.desktop: Make Emacs default application for org-protocol

From: Ihor Radchenko <[email-masked]>
Date: Tue, 19 Sep 2023 13:16:58 +0000

Eli Zaretskii <[email-masked]> writes:

> Specifically, with the following wording be accurate and clear?
>
>   ** On capable systems, Emacs is now the default application for 'org-protocol'.
>   Org mode provides a way to quickly capture bookmarks, notes, and links
>   using 'emacsclient':
>
>       emacsclient "org-protocol://store-link?url=URL&title=TITLE"
>
>   Previously, users had to manually configure their desktop environment
>   to open 'org-protocol' links in Emacs.  On any XDG-compliant system,
>   including GNU/Linux and some others, these links should now open in
>   Emacs automatically, as the "emacsclient.desktop" file now arranges
>   for Emacs to be the default application for the 'org-protocol' URI
>   scheme.  See the Org mode manual, Info node "(org) Protocols" for more
>   details.

Sounds good to me. May also add about Android (Po Lu implemented the
relevant handler in d286f6889cf).

>> Also, a number of applications, expect xdg-open executable to be
>> available on GNU/Linux systems as a generic way to open files using
>> "right" application. Including Emacs itself - see
>> `browse-url-can-use-xdg-open', for example.
>
> Is this related to the issue with org-protocol?

Yes. For example, a browser bookmarklet like

     javascript:location.href='org-protocol://capture?' +
           new URLSearchParams({
                 template: 'x', url: window.location.href,
                 title: document.title, body: window.getSelection()});

will, by default, leverage xdg-open to handle org-protocol://... link
type. xdg-open consults mime-database, built using .desktop files
provided by installed applications.

With the discussed patch, e.g. Firefox will automatically use Emacs when
clicking on the above bookmarklet. Then, strictly speaking, it is not
necessary for the GNU/Linux system to be fully XDG-compiant. It will be
enough that (1) Emacs provides .desktop file; (2) Linux has xdg-open and
its dependencies installed; (3) Firefox makes use of xdg-open.

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