tags:

views:

55

answers:

1

Hi folks,

is it possible, to check if emacs is running in --no-window-system (-nw) mode within the dot-emacs file (.emacs)? I would like to enable/include certain extension only if emacs is in window mode (/or not).

Kind regards, mefiX

+6  A: 

The variable window-system is nil if the selected frame is on a text-only terminal.

pheaver
Great! Thank you!
mefiX
I used `(when window-system ... stuff ...)` to evaluate all the stuff I want only in window mode.
mefiX
Note that the value of `window-system` is specific to the current frame; if you start Emacs in GUI mode then `window-system` will be `t`, but if you connect to that *same* Emacs instance using `emacsclient -t` from a terminal, then `window-system` will be `nil` within that terminal frame. For this reason, it's not good practice to make decisions in `.emacs` based on `window-system` -- instead, embed the corresponding conditional code in hook or other functions that will be called later.
sanityinc
I've never used emacsclient before. Honestly, I don't even know what it is or what it does. So evaluating window-system works fine for me ... at least by now. However, thank you very much for that hint!
mefiX