diff --git a/modules/emacs/eshell/autoload/eshell.el b/modules/emacs/eshell/autoload/eshell.el index 921a4a9eb..45acac222 100644 --- a/modules/emacs/eshell/autoload/eshell.el +++ b/modules/emacs/eshell/autoload/eshell.el @@ -75,6 +75,19 @@ (eshell-send-input nil t)))) +;; +;; Persp-mode integration +;; + +(defun +eshell|switch-workspace () + (setq +eshell-buffers + (or (persp-parameter 'eshell-buffers) + (make-ring 25)))) + +(defun +eshell|save-workspace () + (set-persp-parameter 'eshell-buffers +eshell-buffers)) + + ;; ;; Commands ;; diff --git a/modules/emacs/eshell/config.el b/modules/emacs/eshell/config.el index 21178be71..eaaabf92b 100644 --- a/modules/emacs/eshell/config.el +++ b/modules/emacs/eshell/config.el @@ -81,6 +81,11 @@ You should use `det-eshell-alias!' to change this.") ;; Enable autopairing in eshell (add-hook 'eshell-mode-hook #'smartparens-mode) + ;; Persp-mode/workspaces integration + (when (featurep! :feature workspaces) + (add-hook 'persp-activated-functions #'+eshell|switch-workspace) + (add-hook 'persp-before-switch-functions #'+eshell|save-workspace)) + ;; UI enhancements (defun +eshell|remove-fringes () (set-window-fringes nil 0 0)