mefiX
mefiX

Reputation: 1307

Emacs: check for no-window-system in .emacs

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

Upvotes: 21

Views: 4289

Answers (2)

Tim X
Tim X

Reputation: 4235

Put the code you want to run when emacs executes in a windowed environment inside a when block and use the display-graphic-p predicate i.e.

(when (display-graphic-p)
  (do something)
  (do-another-thing))

or reverse

Upvotes: 10

pheaver
pheaver

Reputation: 1843

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

Upvotes: 23

Related Questions