From 46ba5826cd470cc196b1db12a3cd24016fa285d5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 10 Oct 2021 21:14:30 +0200 Subject: [PATCH] fix(eshell,shell): display buffer post-init By displaying them pre-init: a) eshell will not have loaded, ensuring any user-popup rules in an (after! eshell ...) block don't load in time for the first eshell popup, b) Popup predicate functions don't have access to the full state of the buffer, if needed. --- modules/term/eshell/autoload/eshell.el | 5 +++-- modules/term/shell/autoload.el | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/term/eshell/autoload/eshell.el b/modules/term/eshell/autoload/eshell.el index c14519286..01d227038 100644 --- a/modules/term/eshell/autoload/eshell.el +++ b/modules/term/eshell/autoload/eshell.el @@ -102,13 +102,14 @@ (let (confirm-kill-processes) (delete-window win) (ignore-errors (kill-buffer eshell-buffer))) - (with-current-buffer (pop-to-buffer eshell-buffer) + (with-current-buffer eshell-buffer (doom-mark-buffer-as-real-h) (if (eq major-mode 'eshell-mode) (run-hooks 'eshell-mode-hook) (eshell-mode)) (when command - (+eshell-run-command command eshell-buffer)))))) + (+eshell-run-command command eshell-buffer))) + (pop-to-buffer eshell-buffer)))) ;;;###autoload (defun +eshell/here (&optional command) diff --git a/modules/term/shell/autoload.el b/modules/term/shell/autoload.el index c6fdd8171..6fad60dae 100644 --- a/modules/term/shell/autoload.el +++ b/modules/term/shell/autoload.el @@ -73,11 +73,12 @@ If popup is focused, kill it." (set-process-query-on-exit-flag (get-buffer-process buffer) nil) (delete-window win) (ignore-errors (kill-buffer buffer))) - (with-current-buffer (pop-to-buffer buffer) + (with-current-buffer buffer (if (not (eq major-mode 'shell-mode)) (shell buffer) (cd dir) - (run-mode-hooks 'shell-mode-hook)))) + (run-mode-hooks 'shell-mode-hook))) + (pop-to-buffer buffer)) (when-let (process (get-buffer-process buffer)) (set-process-sentinel process #'+shell--sentinel) (+shell--send-input buffer command))))