Close window of past eshell buffer, but not when it's the last

This reverts 5cda3fe77c and fixes the underlying issue of deleting the
last window.
This commit is contained in:
Daniel Borchmann 2025-10-12 20:48:29 +02:00
parent 5cda3fe77c
commit 3754720221
No known key found for this signature in database
GPG Key ID: 50EA937BF472ADD1

View File

@ -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