From 3754720221b9d526d5d42bf9f2f81d9da5cc482c Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 12 Oct 2025 20:48:29 +0200 Subject: [PATCH] Close window of past eshell buffer, but not when it's the last This reverts 5cda3fe77c2ad68515a57399a6dc7851c9319b99 and fixes the underlying issue of deleting the last window. --- init.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 6acf3d7..1964674 100644 --- a/init.el +++ b/init.el @@ -2867,7 +2867,13 @@ Note that this workaround is incomplete, as explained in this comment." ;; outside of Emacs. (add-hook 'eshell-mode-hook #'(lambda () - (setq-local completion-in-region-function #'completion--in-region))))) + (setq-local completion-in-region-function #'completion--in-region))) + + ;; Close window after eshell is gone, but only if there are other windows around + (advice-add 'eshell-life-is-too-much + :after #'(lambda () + (unless (= 1 (length (window-list (window-frame (selected-window))))) + (delete-window (selected-window))))))) (use-package em-prompt :commands (eshell-previous-prompt