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, 
        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
  • $\begingroup$ What is your OS? I can open vim on Mac easily with Run... $\endgroup$
    – Bichoy
    Jun 6 '15 at 3:38
  • 1
    $\begingroup$ 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 " ] $\endgroup$
    – elbOlita
    Jun 6 '15 at 5:52
  • $\begingroup$ @qazwsx Try evaluating SetEnvironment["LD_LIBRARY_PATH" -> ""] first. $\endgroup$
    – ilian
    Jun 7 '15 at 21:13
  • $\begingroup$ Could you explain why LD_LIBRARY _PATH needs to be set to empty string? $\endgroup$
    – qazwsx
    Jun 10 '15 at 4:53
  • $\begingroup$ @qazwsx Slightly expanded version posted as an answer here. $\endgroup$
    – ilian
    Jul 12 '15 at 17:58

Browse other questions tagged or ask your own question.