Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

3 Answers 3

Okay, found it myself. Just add

;; turn off toolbar
(if window-system
    (tool-bar-mode 0))
share|improve this answer

another way to do it would be:

 (if (functionp 'tool-bar-mode) (tool-bar-mode 0))

like this, the function is called only if it exists

share|improve this answer

It works for me without complaint on Linux. You might try nil or -1 instead of 0:

(tool-bar-mode nil)

What happens if you do emacs -nw?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.