首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Emacs eshell退出时终止窗口

Emacs eshell退出时终止窗口
EN

Stack Overflow用户
提问于 2018-08-16 07:21:08
回答 1查看 521关注 0票数 2

我的init.el中有以下代码

代码语言:javascript
复制
;;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之前,它工作得很好。当我退出时,窗口保持打开状态。如何让窗口自动关闭?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-08-16 08:04:19

下面的答案假设用户在*Eshell*缓冲区的命令提示符下输入exit,然后按return/enter键,并且该答案假定函数eshell/exit正在执行其操作。用户仍然可以自由地自定义变量eshell-kill-on-exit,以便在退出时掩埋或终止*Eshell*缓冲区。

代码语言:javascript
复制
(require 'eshell)

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

(advice-add 'eshell-life-is-too-much :after 'my-custom-func)
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51867693

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档