I have some items in my .emacs that I don't want to run if I ran emacs -nw
. How can I tell in elisp if that is the case?
(edited to change -nox to -nw --- where was my brain?)
Your answer above is correct, although if you want to differentiate between other window systems and only want to run the code if you are actually using X, you'd have to go
(if (eq window-system 'X) (foo))
I think I found my own answer:
(when window-system
(foo))
will only foo when I'm running in X.
Note that the question is somewhat ill-conceived: Emacs can run with both tty frames and GUI frames at the very same time.
The window-system
variable is "terminal-local" which means that its value will depend on whether the currently selected frame is a tty frame or GUI frame.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With