0

When I type emacs it opens it in the terminal window.

I wish it to open in it's regular separate window (the color scheme look different in the terminal compared to the separate window). I tried "emacs -c" and "emacsclient -c", both don't work.

How can i do that?

I am using centos 7 ( just starting to transition to linux) , there is no emacs ,so I install and the version I get is 24.3.1

  • 1
    What's the value of the DISPLAY variable in the shell where you ran emacs? – db48x Nov 14 '15 at 15:42
  • Display :0 unavailable, simulating -nw – I Ko Nov 14 '15 at 15:48
  • Ok, so presumably your DISPLAY variable has a value of :0; this is the usual value and is most likely to be correct. What happens if you run some other program that wants to open an X window? Try running xeyes; you should see a pair of eyes that follow the mouse cursor. – db48x Nov 14 '15 at 16:08
  • i had to install, and when i type xeyes(as root) i get : No protocol specified Error: Can't open display: :0 – I Ko Nov 14 '15 at 16:45
  • Don't run xeyes as root, but as your normal user. If it doesn't work then you've got some problem which isn't related to emacs. – db48x Nov 14 '15 at 17:16
1

If you want to edit a configuration file which is owned by root, you can of course run emacs as root and just live with the fact that it's running in the terminal window.

However, there is a different way that you may find to be better. You can run emacs as yourself, and then open the file using TRAMP. TRAMP is usually used to open files located on remote computers, but it can also open files as root. For example, if you wanted to edit the file /etc/hosts, you would open it via TRAMP by specifying the path /sudo:localhost:/etc/hosts. This will prompt for your password just like the sudo program would, and saves you the hassle of leaving your current emacs session and starting a new one as root.

  • :: is a handy shortcut for :localhost: – Dieter.Wilhelm Nov 16 '15 at 6:15

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.