I have the following code in my init.el
;;open eshell
(defun eshell-other-window ()
(interactive)
(let ((buf (eshell)))
(switch-to-buffer (other-buffer buf))
(switch-to-buffer-other-window buf)
)
)
(global-set-key (kbd "C-t") 'eshell-other-window)
This works fine until I exit eshell. When I exit, the window stays open. How do I get the window to close automatically?
The following answer assumes that the user is typing
exitat the command prompt in the*Eshell*buffer followed by the return/enter key, and the answer assumes that the functioneshell/exitis doing its thing. [The user is still free to customize the variableeshell-kill-on-exitto either burry or kill the*Eshell*buffer when exiting.]