I am having an issue with GNU Emacs 24.3.1. I usually only use emacs for the purpose of compiling .pdf or LaTeX documents. And I am unable to open the program correctly via terminal use. I initially type something like the following:

emacs foo.tex &

The window will appear but not in the normal buffer. It only appears in the scratch buffer. Contrary to this if I type something like:

sudo emacs foo.tex &

I will get the correct buffer in my window but I get an error message that looks like:

(emacs: 3859): GLib-Warning **: In call to g_spawn_sync(), exit status of child process....

I will attach the full error message if needed. I am wondering if it is possible that I may have incorrectly installed emacs. Any advice would be appreciated if anyone is familiar with this sort of issue. Thank you!

EDIT: The output of:

 type emacs

is as follows:

 emacs is hashed (/usr/bin/emacs)
  • Please add the output of type emacs to your question. – Florian Diesch Feb 15 '15 at 18:06
  • @FlorianDiesch I added it per your request. I hope it helps! – Michael Sleevi Feb 15 '15 at 18:15
  • Looks good. In Emacs what's the value of initial-buffer-choice ? You can get that for example with M-: initial-buffer-choice – Florian Diesch Feb 15 '15 at 18:35
  • @FlorianDiesch initial-buffer-choice in sudo emacs gives a value of 'nil', in emacs scratch it gives 'nil' as well. – Michael Sleevi Feb 15 '15 at 18:43
  • Try to remove all Emacs config files. If that doesn't help I don't have any other idea ... – Florian Diesch Feb 15 '15 at 18:58

The solution was that I as the user did not have ownership of the


folder, so I type in the following command to solve it:

sudo chown -R user ~/.emacs.d/

However the GLib-Warning with the sudo emacs is a bug in emacs that hasn't been resolved.

| improve this answer | |
  • 2
    Further, in future when using emacs with sudo, use -H: sudo -H emacs. This sets $HOME to root's , so that files in your home directory are not affected. – muru Feb 16 '15 at 0:20
  • @muru Thank you for the advice I will keep that in mind! – Michael Sleevi Feb 16 '15 at 1:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.