On 28/06/2025 01:28, Ihor Radchenko wrote:
Anush writes:

I get the message “Running xdg-open
/home/<username>/big_buck_bunny.webm...done” but doesn’t open mpv.

pdf files open properly with the default pdf viewer, however.

This might be similar to the "failing silently" issue mentioned at
https://list.orgmode.org/orgmode/874jedoo4d.fsf@localhost/, but I’m
not sure.

I suspect that it is simply xdg-open opening an interactive selection
menu. What happens if you try xdg-open $HOME/big_buck_bunny.webm from terminal?

From the original report

On 15/06/2025 06:15, Anush V wrote:
This behavior is inconsistent because dired-do-open (E) in dired
buffer correctly opens the same file in mpv.

so "xdg-open ~/big_buck_bunny.webm" should work.

I can reproduce a similar issue with kaffeine, but not with mpv-0.35.1

    kaffeine file.webm 2>&1 | head -c 10

The player is killed by SIGPIPE when it tries to write a warning to stderr. I used "strace -f" attached to an emacs process to find the reason. I consider it is a bug in kaffeine.

`shell-command-do-open' works since it uses `call-process' with 0 argument (similar to `browse-url-xdg-open') that passes /dev/null as stderr.

You can try to evaluate (you may use specific video player instead of xdg-open)

(setq movie "~/big_buck_bunny.webm")
(setq movie-cmd
      (format "xdg-open %s" (shell-quote-argument
                             (expand-file-name movie))))
; should work
(call-process "xdg-open" nil 0 nil movie)
; old xdg-open silent failure due to SIGHUP
; when viewer goes to background
(let ((process-connection-type 'pty))
  (start-process-shell-command "xdg-open" nil movie-cmd))
; current `org-open-file' behavior
(let ((process-connection-type nil))
  (start-process-shell-command "xdg-open" nil movie-cmd))

P.S.

https://list.orgmode.org/t7aqif$c2f$1...@ciao.gmane.io/
[PATCH] org.el: Use `call-process' to launch external viewers (was: Re: [BUG] org-open-file immediately termininates when calling xdg-open that calls emacsclient).
Fri, 3 Jun 2022 00:04:12 +0700

Comments should be updated.

Reply via email to