I have my color theme settings and a function to automatically maximize emacs on startup in my .emacs file, however, using this .emacs file with no window mode -nw
results in an error since an X window is not initialized. So I was wondering if it was possible to use a separate init file or check in the original .emacs file to see if emacs is started in no window mode, and then call the maximize and set color theme commands accordingly?
2 Answers
No, window-system
is not recommended for this, ever since graphic-display-p
was added to Emacs (way back in Emacs 22). Do not use (if window-system...)
. Use this instead:
(if (display-graphic-p) ...)
If you use your init file with both an old Emacs version (prior to Emacs 22) and a new one, then use this:
(if (if (fboundp 'display-graphic-p) (display-graphic-p) window-system) ...)
-
Alright, I will use that instead, but what is the difference between display-graphic-p and window-system? Sep 23, 2014 at 15:28
-
-
This answer of @Lindydancer shows the docs of display-graphic-p and window-system and when the use of window-system is not recomended emacs.stackexchange.com/a/8200 Feb 26, 2022 at 23:09