Le 22 Jan 2026, Max Nikulin <[email protected]> a écrit :

> On 22/01/2026 6:20 am, Victor A. Stoichita wrote:
>> cat /usr/local/share/applications/emacsclient.desktop
>> [Desktop Entry]
> [...]
>> MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;x-scheme-handler/org-protocol;
>> Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec /usr/local/bin/emacsclient 
>> --alternate-editor= --reuse-frame \\"\\$@\\"; else exec emacsclient 
>> --alternate-editor= --create-frame; fi" sh %F
>
> %F causes failure, it should be %U. You may edit a copy the file
>  placed into e.g. ~/.local/share/applications
>
> <https://debbugs.gnu.org/74467>
> org-protocol emacsclient.desktop change is not fully functional

%F was the culprit indeed! Changed to %U and it works!

I had read about that bug which is referenced from
https://orgmode.org/worg/org-contrib/org-protocol.html
But maybe the explanation there could be slightly improved. 

The worg page says:
> 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. (NOTE: This is not true for some
> distributions of xdg-tools as reported in the bug #74467 - 31.0.50;
> org-protocol emacsclient.desktop change is not fully functional - GNU
> bug report logs.)

It is not clear what "some distributions of xdg-tools means" (and
I failed to understand it from the bug report as well). I’m on
Debian stable. 

The worg page does not clearly say what to do in that case. I tried
applying what was said below regarding Emacs < 30 (create the
org-protocol.desktop file…), but that didn’t work either (perhaps
because it has %u not %U ?).

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 ?),
> 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.


Thanks again, Max and Christian, for the hints!

Victor


Reply via email to