Il 30/01/2021 14:31, Maxim Nikulin ha wrote:
On 30/01/2021 15:42, Eli Zaretskii wrote:

This works:
M-! xdg-open /tmp/test.pdf RET

This doesn't work:
M-& xdg-open /tmp/test.pdf RET

This doesn't work:
M-x shell RET xdg-open /tmp/test.pdf RET

Geraldo, "M-x shell" case is rather strange. Could you, please, confirm ones more that okular window with the file content does not appear if you call xdg-open from an *interactive* emacs shell buffer? The link to an emacs-orgmode list message, that I have posted earlier, explains why async-shell-command *may* fail while shell-command should work reliably. I am really surprised by failure when command is executed in a [e]shell buffer.


I confirm.
I can see the Okular icon appear and disappear immediately in the panel.
As mentioned I can make a video of everything, but I have no idea where to upload it.
If it is okay to make the video and you think it is useful please tell me which commands to execute for more information on the operating environment

How about asking the xdg-open developers to help us figure out the
reason?  Or, failing that, debug xdg-open in the problematic
situations to find out what fails there and why?  E.g., could it be
that it fails because stdin/stdout is a PTY? what happens if you bind
process-connection-type to nil when starting the async subprocess?

I do not think, it is xdg-open problem. It just calls kde-open5 that spawns actual handler and immediately exits.