tools/eshell: improve popup & term integration

This commit is contained in:
Henrik Lissner 2017-05-12 12:10:04 +02:00
parent 2c68a41adb
commit 29d01756ea
2 changed files with 22 additions and 0 deletions

View file

@ -249,6 +249,27 @@ properties."
(advice-add #'buffer-menu :override #'doom*buffer-menu)) (advice-add #'buffer-menu :override #'doom*buffer-menu))
(after! eshell
;; When eshell runs a visual command (see `eshell-visual-commands'), it spawns
;; a term buffer to run it in, but where it spawns it is the problem.
;; By tying buffer life to its process, we ensure that we land back in the
;; eshell buffer after term dies. May cause problems with short-lived
;; processes.
;; FIXME replace with a 'kill buffer' keybinding.
(setq eshell-destroy-buffer-when-process-dies t)
(defun doom*eshell-undedicate-popup (orig-fn &rest args)
"Force spawned term buffer to share with the eshell popup (if necessary)."
(when (doom-popup-p)
(set-window-dedicated-p nil nil)
(add-transient-hook! eshell-query-kill-processes :after
(message "ding -- %s (%s)" (selected-window) (buffer-name))
(set-window-dedicated-p nil t)))
(apply orig-fn args))
(advice-add #'eshell-exec-visual :around #'doom*eshell-undedicate-popup))
(after! evil (after! evil
(let ((map doom-popup-mode-map)) (let ((map doom-popup-mode-map))
(define-key map [remap evil-window-delete] 'doom/popup-close) (define-key map [remap evil-window-delete] 'doom/popup-close)

View file

@ -16,6 +16,7 @@
eshell-scroll-to-bottom-on-input 'all eshell-scroll-to-bottom-on-input 'all
eshell-scroll-to-bottom-on-output 'all eshell-scroll-to-bottom-on-output 'all
eshell-buffer-shorthand t eshell-buffer-shorthand t
eshell-kill-processes-on-exit t
;; em-prompt ;; em-prompt
eshell-prompt-function #'+eshell/prompt eshell-prompt-function #'+eshell/prompt
;; em-glob ;; em-glob