# How to trigger Emacs to open a file from Mathematica? [duplicate]

I thought Run will do the trick:

Run["emacs -q " <> myfile]
Run["! emacs -q " <> myfile]


But it does not! I'm using M 10 and Ubuntu Linux + Zsh.

In[11]:= RunProcess[$SystemShell,All,"emacs -q "<>"/tmp/XXX.txt"<>" \n \n exit \n \n "] Out[11]= <|ExitCode->127, StandardOutput->, StandardError->emacs: symbol lookup error: /usr/lib/x86_64-linux-gnu/libatspi.so.0: undefined symbol: g_type_class_adjust_private_offset |>  The following runs, but Emacs did not get started: In[12]:= Run["! /usr/bin/emacs " <> "/tmp/XXX.txt"] Out[12]= 0 In[13]:= Run["!/usr/bin/emacs " <> "/tmp/XXX.txt"] Out[13]= 32512  • What is your OS? I can open vim on Mac easily with Run... Jun 6 '15 at 3:38 • mmm.... I suspect that the problem is that you need to specify the complete path. My guess is that it woul be /bin/emacs to find it for sure run whereis emacs in terminal. Also to debug a terminal process, it is best to run RunProcess, as it is able to return the standard output and error output. Dont forget to keep the returns (\n) and the exit since otherwise it will run forever and never return and answer. RunProcess[$SystemShell, All, "emacs -q " <> mifile <> " \n \n exit \n \n " ] Jun 6 '15 at 5:52
• @qazwsx Try evaluating SetEnvironment["LD_LIBRARY_PATH" -> ""] first. Jun 7 '15 at 21:13
• Could you explain why LD_LIBRARY _PATH needs to be set to empty string? Jun 10 '15 at 4:53
• @qazwsx Slightly expanded version posted as an answer here. Jul 12 '15 at 17:58