From 84fc356e40dc6ebea09fc6b5dc6f00ee07a9e568 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 15 May 2018 01:32:05 +0200 Subject: [PATCH] tools/eshell: dedicate eshell windows Disallow commands to change their buffer non-interactively. --- modules/tools/eshell/autoload/eshell.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/tools/eshell/autoload/eshell.el b/modules/tools/eshell/autoload/eshell.el index d720240b3..d9ceb085a 100644 --- a/modules/tools/eshell/autoload/eshell.el +++ b/modules/tools/eshell/autoload/eshell.el @@ -71,9 +71,9 @@ "Open eshell in the current buffer." (interactive) (let ((buf (+eshell--buffer (eq major-mode 'eshell-mode)))) + (switch-to-buffer buf) (with-current-buffer buf (unless (eq major-mode 'eshell-mode) (eshell-mode))) - (switch-to-buffer buf) (when command (+eshell-run-command command)))) @@ -129,12 +129,20 @@ module to be loaded." (dolist (buf (ring-elements +eshell-buffers)) (unless (buffer-live-p buf) (+eshell--remove-buffer buf))) + (let ((window (selected-window))) + (set-window-parameter window 'no-other-window t) + (set-window-parameter window 'visible t) + (set-window-dedicated-p window t)) (+eshell--add-buffer buf) (setq +eshell-last-buffer buf))) ;;;###autoload (defun +eshell|cleanup () "Close window (or workspace) on quit." + (let ((window (selected-window))) + (set-window-parameter window 'no-other-window nil) + (set-window-parameter window 'visible t) + (set-window-dedicated-p window nil)) (+eshell--remove-buffer (current-buffer)) (cond ((and (featurep! :feature workspaces) (string= "eshell" (+workspace-current-name)))