Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To disable the scrollbar in emacs I added (toggle-scroll-bar -1) to the my .emacs file and it works great when I run emacs outside of console mode. However when I run emacs in the terminal I get the error Symbol's function definition is void: toggle-scroll-bar

I'm running Emacs 23.3.1

heres the trace when I run --debug-init

    1 Debugger entered--Lisp error: (void-function scroll-bar-mode)                
    2   (scroll-bar-mode -1)                                                       
    3   eval-buffer(#<buffer  *load*> nil "/Users/neil/.emacs.d/init.el" nil t)  ;$
    4   load-with-code-conversion("/Users/neil/.emacs.d/init.el" "/Users/neil/.ema$
    5   load("/Users/neil/.emacs.d/init" t t)                                      
    6   #[nil "^H\205\264^@   \306=\203^Q^@\307^H\310Q\2027^@ \311=\2033^@\312\307$
    7   command-line()                                                             
    8   normal-top-level()
share|improve this question
    
Emacs probably gave you a Warnings buffer telling you to run emacs with the --debug-init option to get a complete error backtrace. Try that and add that information to the question. Along with the Emacs version M-x emacs-version. That chunk of code works just fine with Emacs 23.2. – Trey Jackson Jul 21 '11 at 21:48
    
@Trey Jackson, I added the details you requested, I seem to be running Emacs 23.1, so I'll try upgrading. Thank you for your suggestions. – bneil Jul 22 '11 at 16:23
    
Very odd. Ok, next test is running Emacs w/out your .emacs, emacs -nw -q, and then in the scratch buffer, type (scroll-bar-mode -1)C-j and see if you get an error. That function is distributed with Emacs in the scroll-bar.el package, so I'm guessing your .emacs has something odd, or the Emacs wasn't installed properly. – Trey Jackson Jul 22 '11 at 16:25
    
I get this error upon doing that Debugger entered--Lisp error: (void-function scroll-bar-mode) (scroll-bar-mode -1) eval((scroll-bar-mode -1)) eval-last-sexp-1(t) eval-last-sexp(t) eval-print-last-sexp() call-interactively(eval-print-last-sexp nil nil) – bneil Jul 22 '11 at 16:30
    
Here is my .emacs file pastebin.com/4mYE91Ne too – bneil Jul 22 '11 at 16:34
up vote 11 down vote accepted

FWIW. The emacs manual discourage the use of window-system as a predicate.

Do not use window-system and initial-window-system as predicates or boolean flag variables, if you want to write code that works differently on text terminals and graphic displays. That is because window-system is not a good indicator of Emacs capabilities on a given display type. Instead, use display-graphic-p or any of the other display-*-p predicates described in Display Feature Testing.

http://www.gnu.org/software/emacs/manual/html_node/elisp/Window-Systems.html

I use this to turn off the scrollbar and toolbar when in a graphical display.

(if (display-graphic-p)
    (progn
      (tool-bar-mode -1)
      (scroll-bar-mode -1)))
share|improve this answer
    
ah ok thanks for the clarification – bneil Oct 4 '12 at 7:34

While I think @neatonk's answer is best and covers all the bases, to specifically disable the scroll bar you can put the following in your ~/.emacs

(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
share|improve this answer

My guess is when you open emacs -nw emacs doesn't even bother to load scroll-bar.el. thats why it is having trouble to find the function toggle-scroll-bar.
may be instead if you put
(scroll-bar-mode -1)
probably work.

share|improve this answer
1  
(toggle-scroll-bar -1) works just fine in emacs -nw for Emacs 23.2... – Trey Jackson Jul 21 '11 at 21:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .