Fix +eshell/open-fullscreen reusing eshell buffers

It should spawn a new one, no matter what. Also fixes wconf restoration
on quit.
This commit is contained in:
Henrik Lissner 2018-06-27 19:23:27 +02:00
parent 029824b6c1
commit 5bcec25529
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -7,7 +7,6 @@
(defvar +eshell--last-buffer nil) (defvar +eshell--last-buffer nil)
(defvar-local +eshell--wconf nil)
;; ;;
@ -106,11 +105,14 @@
"Open eshell in a separate workspace. Requires the (:feature workspaces) "Open eshell in a separate workspace. Requires the (:feature workspaces)
module to be loaded." module to be loaded."
(interactive "P") (interactive "P")
(let ((default-directory (if arg default-directory (doom-project-root)))) (let ((default-directory (if arg default-directory (doom-project-root)))
(setq +eshell--wconf (current-window-configuration)) (buf (+eshell--unused-buffer 'new)))
(set-frame-parameter nil 'saved-wconf (current-window-configuration))
(delete-other-windows) (delete-other-windows)
(with-current-buffer (+eshell/open arg command) (with-current-buffer (switch-to-buffer buf)
(setq-local +eshell--wconf (current-window-configuration))))) (eshell-mode)
(if command (+eshell-run-command command buf)))
buf))
;; ;;
@ -247,8 +249,10 @@ delete."
(let ((buf (current-buffer))) (let ((buf (current-buffer)))
(when (+eshell--remove-buffer buf) (when (+eshell--remove-buffer buf)
(+eshell--setup-window (get-buffer-window buf) nil) (+eshell--setup-window (get-buffer-window buf) nil)
(cond (+eshell--wconf (cond ((and (one-window-p)
(set-window-configuration +eshell--wconf)) (window-configuration-p (frame-parameter nil 'saved-wconf)))
(set-window-configuration (frame-parameter nil 'saved-wconf))
(set-frame-parameter nil 'saved-wconf nil))
((one-window-p) ((one-window-p)
(let ((prev (save-window-excursion (previous-buffer)))) (let ((prev (save-window-excursion (previous-buffer))))
(unless (and prev (doom-real-buffer-p prev)) (unless (and prev (doom-real-buffer-p prev))