Hi I'm asking this question because this;[1]: Different theme for -nw (terminal) and few others didn't work for me. Allright, first of all I am not a programmer/devoloper, and I don't know lisp (thinking about learning it, but too busy). The problem I encountered is when I use emacs on gui with standart theme, it hurts my eyes, and the theme is just ugly. But when I use it on terminal (emacs -nw with no theme) it is beautiful because of the terminal theme/compton etc. Sometimes I have to use gui for a quick edit on desktop files or some other files, I'd like to ask you, how can I achive, to run emacs with some theme when on gui, and no theme on terminal.[2]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Display-Feature-Testing.html I've seen this part of gnu/emacs manual, I understood what the "display-graphic-p" and "if" codes do but not sure how to use it, because I don't want any other theme to load on emacs when I use it on terminal.
Asked
Active
Viewed 1,060 times
1 Answers
2
It sounds like you want the following?
(when (display-graphic-p)
(enable-theme 'solarized))
You can replace 'solarized
with another theme.
p.s. This when
expression is equivalent to an if
with a "do nothing" else clause:
(if (display-graphic-p)
(enable-theme 'solarized)
nil)
Emacs Lisp also lets you write a "one armed if
":
(if (display-graphic-p)
(enable-theme 'solarized))
But some people (like me) think it's clearer to use when
-- to
emphasize that the expression is "for effect" not "for result".

Greg Hendershott
- 1,483
- 12
- 17
-
Thank you for the explenation of codes, I really appreciate it. I couldn't make it work though. I managed to load the theme by inserting custom enabled themes "wombat" or "zenburn" but now, the theme loads on terminal too, can not prevent this. – Caner Tanyeri May 27 '17 at 20:49
-
you should then have something like: `(if (not (display-graphic-p)) (load-theme 'desired-theme t))` in order to load the right theme on terminal – mclear May 27 '17 at 22:06
-
@mclear Note that `(if (not
) – Basil May 28 '17 at 14:54)` is equivalent to `(unless )`.