How to prevent the "Symbol's function definition is void: error" when running emacs in the console?
Solution 1
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)))
Solution 2
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))
Related videos on Youtube
bneil
Updated on September 18, 2022Comments
-
bneil almost 2 years
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()
-
Trey Jackson almost 13 yearsEmacs 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 versionM-x emacs-version
. That chunk of code works just fine with Emacs 23.2. -
bneil almost 13 years@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.
-
Trey Jackson almost 13 yearsVery 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 thescroll-bar.el
package, so I'm guessing your.emacs
has something odd, or the Emacs wasn't installed properly. -
bneil almost 13 yearsI 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 almost 13 yearsHere is my .emacs file pastebin.com/4mYE91Ne too
-
Trey Jackson almost 13 yearsOk, now how about
M-x find-library simple RET
- that should take you to where Emacs is installed, thenC-x C-d
to open a dired, and in that directory there should be ascroll-bar.elc
. Though the directions might fail if the Emacs wasn't installed with source lisp code... -
bneil almost 13 years@TreyJackson let us continue this discussion in chat
-
-
Trey Jackson almost 13 years
(toggle-scroll-bar -1)
works just fine inemacs -nw
for Emacs 23.2...