I'm using emacs in Win10 WSL 2 Linux and call a custom script open in my $PATH to open files from WSL-Linux/emacs in Windows GUI. My .mailcap makes sure that the script is actually being used and the right program is being called, e.g. for a HTML file file.html in the current directory my browser should open the file. This successfully works

  • from terminal with open file.html
  • with ! in dired buffer and
  • with evil :! in buffer file.html
  • with M-! open file.html RET.

However, when I export and open the file via org-export mechanism, the script is being called, but nothing happens. The same happens when using eshell instead of shell. In both cases I can see the following processes:

emacs --daemon
├─ /bin/bash /home/username/bin/open /path/to/file.html 
│  └─ /tools/init /mnt/c/Windows/explorer.exe \\wsl$\Ubuntu\path\to\file.html

I don't know about this process /tools/init and didn't find useful information online. I tried this solution and added (push "open" eshell-visual-commands) to my init.el. Now opening works from eshell, but it still fails with the org-export mechanism and the /tools/init child-process is visible. At this point I'm clueless how to fix it, as this is way beyond my scope. I guess it has to do with how emacs calls the script internally.

How can I make my open script being called correctly when exporting from org-mode?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.