Emacs eshell - 退出时杀死窗口

标签 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。当我退出时, window 保持打开状态。如何让窗口自动关闭?

最佳答案

以下答案假设用户在 *Eshell* 缓冲区中的命令提示符处键入 exit,然后按回车/回车键,并且答案假设函数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)

关于Emacs eshell - 退出时杀死窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51867693/

相关文章:

ubuntu - Shift 键在我的 emacs 中不起作用

emacs - 将 subversion 与 spacemacs 一起使用

erlang - 为什么在 : '{' ? 之前出现语法错误

search - eshell 搜索历史

shell - zsh 和 emacs 的 (e)shell 之间的优缺点

emacs - 在 Emacs 中,如何粘贴到多术语中

C/C++ 的 Emacs 代码完成?

Emacs Lisp : how to avoid inserting a duplicate list item?

regex - 为什么我在 eshell 中使用 sed 会得到奇怪的结果?

erlang - erlang如何:now() work?