From ac815a06f1a632a085edad350e8ef64c9a7d4148 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 12 Jul 2020 13:00:28 +0200 Subject: [PATCH] Close window when hiding current shell For eshell we do the same. --- site-lisp/db-utils.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index 5733d28..25d4cea 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -62,14 +62,13 @@ If already in `*ansi-term*' buffer, bury it." (find-file user-init-file)) (defun db/run-or-hide-shell () - "Opens an shell buffer if not already in one, and otherwise - returns to where we have been before." + "Opens an shell buffer if not already in one, and closes it +otherwise." (interactive "") - (if (string= "shell-mode" major-mode) - (progn - (bury-buffer) - (other-window -1)) - (shell))) + (if (not (eq 'shell-mode major-mode)) + (shell) + (bury-buffer) + (delete-window))) ;;; General Utilities