Question

When I use C-x 2/3 to open a new window in Emacs, I usually want to do something in the other window, such as shell, open a buffer or visit a new file, but I always change into the other window manually. Is there a way(maybe defun a new function in .emacs, but I'm new to Emacs) that I can switch my point into the other window immediately after C-x 2/3 just like when you open a new tab and switch to it immediately in a browser???

Was it helpful?

Solution

How about just wrapping the function using something like this:

(defun my-split-window-below ()
  (interactive)
  (let ((win (split-window-below)))
    (set-frame-selected-window (selected-frame) win)))

You could also do defadvice on split-window-below using after, and have it select the window, but I'm not sure that it's a better solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top