tools/eshell: dedicate eshell windows

Disallow commands to change their buffer non-interactively.
This commit is contained in:
Henrik Lissner 2018-05-15 01:32:05 +02:00
parent d0f8bf402a
commit 84fc356e40
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

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