error with "other-window" with "emacs-startup-hook"
When I open emacs, I would like to see the following:
2 windows, left window is for editing the document and the right windows run the program "multi-term"
I tried to edit my ~/.emacs with:
开发者_如何学JAVA(add-hook 'emacs-startup-hook 'other-window)
(add-hook 'emacs-startup-hook 'multi-term)
(add-hook 'emacs-startup-hook 'split-window-horizontally)
the last two commands work, i.e I get 2 windows, one in left and one in right and the left one runs multi-term. (Althought I wanna the converse). But the command
(add-hook 'emacs-startup-hook 'other-window)
doesn't work. I get
wrong number of arguments: other-window, 0
Why? I think I can do everything if I type a correct function name, if this function really works if I type it in Emacs with M-x function_name.
How could I resolve this problem?
The command other-window
takes an argument, which you're not providing. When you hit the keys C-x n, the argument is filled in for you automatically. Try:
(add-hook 'emacs-startup-hook (lambda () (other-window 1)))
Or, you could mimic the keystroke by doing:
(add-hook 'emacs-startup-hook (lambda () (call-interactively 'other-window)))
精彩评论