Emacs eshell-退出时终止窗口

时间:2018-08-15 23:21:08

标签: emacs eshell

我的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)

这很好,直到我退出eshell。当我退出时,窗户保持打开状态。如何使窗口自动关闭?

1 个答案:

答案 0 :(得分:2)

以下答案假定用户在命令提示符下的exit缓冲区中键入*Eshell*,然后按回车/确认键,并且答案假定函数eshell/exit为做它的事情。 [用户仍然可以自定义变量eshell-kill-on-exit,以退出时埋入或杀死*Eshell*缓冲区。]

  
(require 'eshell)

(defun my-custom-func () 
  (when (not (one-window-p))
    (delete-window)))

(advice-add 'eshell-life-is-too-much :after 'my-custom-func)
相关问题