On 24/01/2026 11:26 pm, Christian Moe wrote:
"Victor A. Stoichita" writes:

If I may suggest, the paragraph could read:
On GNU/Linux, Emacs 29.2+ configures emacsclient.desktop to handle Org
Protocol URL requests. If your GUI window environment can use this
file, no further setup is required.
However on some distributions of xdg-tools (such as Debian Trixie ?),

Proper XDG implementation must not pass URL (org-protocol:... or file:///...) to handlers with %F. I am unsure if some desktop environment can do it. I expect that the only case when %F "works" (actually relies on a bug) is no desktop environment and old xdg-open that may pass URL to an application that expects file path.

a manual change in emacsclient.desktop is required. Because of bug
#74467 - 31.0.50; "org-protocol emacsclient.desktop change is not
fully functional", xdg-open might open an emacsclient frame, without
passing it the org-protocol arguments. A workaround for this is to
replace %F with %U on the Exec lines of emacsclient.desktop.

Can this sometimes create problems?

Currently it is safer to leave %F for emacsclient.desktop as file handler and to create another .desktop file with %U in Exec and NoDisplay=true for org-protocol.

I don't see any problem with opening files with emacsclient myself after
testing this, though. It may be that it's not a problem on my system
(Mint).

Have you tried to open some file in Emacs from e.g. GUI file manager? Is there chance that you have url handler mode enabled?

Reading new comments to #74467, I noticed a mention of
<https://debbugs.gnu.org/79066#8>

From my point of view, it means that Emacs developers consider XDG handler .desktop file as unsupported. A request that ALTERNATE_EDITOR environment should be respected resulted in nothing but rant.

In its current form emacsclient.desktop is almost unmaintainable due to abundant backslashes. (Assuming that $DISPLAY is properly quoted, adding $ALTERNATE_EDITOR does not look challenging though.) An option to provide a wrapper script was discarded for some reason.

Even in the case of strong position to not provide convenience command line option for emacs and emacsclient binaries to run them as XDG handler (to incorporate logic with creating frame, DISPLAY, alternate editor), there is anyway emacsclient-mailto.desktop that may be generalized to handle file:///, org-protocol:, and schemes added by packages or by user besides mailto: as

   emacsclient ... --eval (handle-url-emacsclient) %U

Reply via email to