I am trying to launch Emacs through a keyboard shortcut on my Debian/xmonad system. Relevant lines from my xmonad.hs:

~$ cat .xmonad/xmonad.hs
import XMonad


main =
  xmonad =<< xmobar
  (defaultConfig {modMask = mod4Mask, terminal="gnome-terminal"}
   [ ("M-e", spawn "emacs"),

~$ xmonad --recompile

(and even restart, I'm just proving minimal sanity here)

When I use the keyboard shortcut, nothing happens and if I inspect my .xsession-errors I can see:

~$ tail -n1 .xsession-errors 
emacs: standard input is not a tty

If I just start Emacs from the terminal I go in "terminal mode".


~$ echo $DISPLAY

How can I further debug this?

Further version info:

$ apt-cache policy emacs
  Installed: 46.1
  Candidate: 46.1
  Version table:
 *** 46.1 995
        995 http://ftp.se.debian.org/debian testing/main amd64 Packages
$ apt-cache policy emacs-nox
  Installed: (none)
  Candidate: 46.1
  Version table:
     46.1 995
        995 http://ftp.se.debian.org/debian testing/main amd64 Packages
$ emacs --version
GNU Emacs 24.5.1
Copyright (C) 2015 Free Software Foundation, Inc.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
  • 5
    Has Emacs been compiled with GUI support? How did you install it? – phils May 4 '16 at 10:54
  • 3
    Is this an Emacs problem or an xmonad problem? If the latter, we might want to migrate you to the Linux and Unix sister site. – Dan May 4 '16 at 13:30
  • 3
    I'm voting to close this question as off-topic because it belongs on unix.stackexchange.com – jch May 4 '16 at 19:25
  • 1
    aronisstav: I've no idea what version 46.1 means (Emacs 25 is in pre-release right now), but if it's a debian package then I suspect you've only installed the emacs-nox (I think it's called) package. 'nox' being 'No X support'. – phils May 4 '16 at 22:18
  • 1
    Have you tried emacs -Q? If you've got a properly installed emacs, running the command emacs should start the GUI version. It looks like you do have the GUI version installed, so the fact that it is opening in 'terminal mode' suggests that maybe there's something in your config that's explicitly requesting the non-GUI version. Maybe :/ – Tyler May 5 '16 at 1:31

Managed to find a solution with the help of some comments, so here's an answer:

@YoungFrog suggested I check the value of system-configuration-options (with C-h v) which revealed that the Emacs version I was running was configured with the --with-x=no option. This is a global setting, not related to the fact that I was reading the variable from the console.

This prompted me to try and reinstall the package, and I found out that @phils was right all along, as it turns out I had emacs24-nox (but not the metapackage emacs-nox) installed. Why was this one preferred over the plain emacs24 eludes me... Removing emacs24-nox automatically selected emacs24 and the problem was resolved.

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.