I have this line in my .emacs
file:
(tool-bar-mode 0)
because I hate the toolbars in my GUI emacs (/Applications/Emacs.app/Contents/MacOS/Emacs
).
But when I start up my other, text-based emacs in the terminal (/opt/local/bin/emacs
) it complains about that command:
Symbol's function definition is void: tool-bar-mode
How can I add an if
condition so that it executes the tool-bar-mode
command only when I'm in the GUI emacs?
Thanks!
Okay, found it myself. Just add
another way to do it would be:
like this, the function is called only if it exists
It works for me without complaint on Linux. You might try
nil
or-1
instead of0
:What happens if you do
emacs -nw
?Use of the
window-system
variable as a boolean is deprecated. Instead, usedisplay-graphic-p
or any of the otherdisplay-*-p
predicates which report frame’s specific UI-related capabilities.In case you want your code to be backward-compatible with the previous versions of Emacs, then the following compatibility wrapper is the way to go: