tags:

views:

83

answers:

3

Is there a way to run certain commands (from init.el) only when I am in GUI mode and not in terminal mode. I want to set a certain color scheme when I run the GUI version, but that scheme screws up the terminal window's colors pretty badly. I'm looking for some variable/function which would look something like this:

(if gui-mode (color-scheme-blah))

or:

(unless terminal-mode (color-scheme-blah))
+11  A: 

You want something like

(if window-system (color-scheme-blah))

window-system can be 'x or 'mswindows or possibly even other values, but it's always nil when you are on a terminal.

Kilian Foth
Just what I needed, thanks!
auramo
+1  A: 

When using emacsclient and frames GUI or terminal mode is not necessarily a global concept. See the very useful answer to my question at http://superuser.com/questions/165335/how-can-i-show-the-emacs-menu-in-gui-emacs-frames-but-not-in-tty-frames-when-usin .

Mike Crowe
+1  A: 

To generally test for a graphic display you want to use the following:

(display-graphic-p &optional DISPLAY)

It returns non-nil if DISPLAY is a graphic display. Using for example the window-system variable also works, but requires you to refer to a specific environment (such as X or Microsoft Windows).

Seppo Sade