0

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:

(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?

koopajah
  • 23,792
  • 9
  • 78
  • 104
user565739
  • 1,302
  • 4
  • 23
  • 46
  • I have try to google " (add-hook 'emacs-startup-hook 'other-window) ", but no information for this. – user565739 Jan 06 '11 at 16:41
  • I found that (multi-term) (other-window 1) (split-window-horizontally) in ~/.emacs can achieve what I wanna do, i.e the left one is the doc. I wanna to edit and the right one is multi-term. But If I type M-x multi-term M-x other-window M-x split-window-horizontally, I get two windows with the same buffer. Is there any difference between other-window 1 and other-window? I can't type M-x other-window 1 in emacs, I can only add this in ~/.emacs. – user565739 Jan 06 '11 at 18:39

1 Answers1

0

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)))
Trey Jackson
  • 73,529
  • 11
  • 197
  • 229