Show default eshell buffer in normal window

This commit is contained in:
Daniel Borchmann 2025-07-14 17:26:13 +02:00
parent a8446ce820
commit 072fd2887b
No known key found for this signature in database
GPG Key ID: 50EA937BF472ADD1

View File

@ -36,11 +36,13 @@ eshell buffer."
(let ((current-dir (expand-file-name default-directory))) (let ((current-dir (expand-file-name default-directory)))
(cl-flet ((in-eshell-buffer-p () (cl-flet ((in-eshell-buffer-p ()
(and (derived-mode-p 'eshell-mode) (and (derived-mode-p 'eshell-mode)
(string-match-p "^\\*eshell-side\\*" (buffer-name))))) (string-match-p "^\\*eshell\\*" (buffer-name)))))
(if (and (not arg) (if (and (not arg)
(in-eshell-buffer-p)) (in-eshell-buffer-p))
(progn
(bury-buffer) (bury-buffer)
(delete-window))
(unless (in-eshell-buffer-p) (unless (in-eshell-buffer-p)
(if-let ((eshell-window (cl-find-if (lambda (window) (if-let ((eshell-window (cl-find-if (lambda (window)
@ -49,7 +51,7 @@ eshell buffer."
(window-list-1)))) (window-list-1))))
(select-window eshell-window) (select-window eshell-window)
;; No running eshell found, open new one. ;; No running eshell found, open new one.
(--if-let (display-buffer (let ((eshell-buffer-name "*eshell-side*")) (eshell))) (--if-let (display-buffer (let ((eshell-buffer-name "*eshell*")) (eshell)))
(select-window it) (select-window it)
(error "Could not start eshell (`display-buffer' returned nil)")))) (error "Could not start eshell (`display-buffer' returned nil)"))))