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.
This commit is contained in:
Henrik Lissner 2021-10-10 21:14:30 +02:00
parent b15abdbd74
commit 46ba5826cd
2 changed files with 6 additions and 4 deletions

View file

@ -102,13 +102,14 @@
(let (confirm-kill-processes) (let (confirm-kill-processes)
(delete-window win) (delete-window win)
(ignore-errors (kill-buffer eshell-buffer))) (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) (doom-mark-buffer-as-real-h)
(if (eq major-mode 'eshell-mode) (if (eq major-mode 'eshell-mode)
(run-hooks 'eshell-mode-hook) (run-hooks 'eshell-mode-hook)
(eshell-mode)) (eshell-mode))
(when command (when command
(+eshell-run-command command eshell-buffer)))))) (+eshell-run-command command eshell-buffer)))
(pop-to-buffer eshell-buffer))))
;;;###autoload ;;;###autoload
(defun +eshell/here (&optional command) (defun +eshell/here (&optional command)

View file

@ -73,11 +73,12 @@ If popup is focused, kill it."
(set-process-query-on-exit-flag (get-buffer-process buffer) nil) (set-process-query-on-exit-flag (get-buffer-process buffer) nil)
(delete-window win) (delete-window win)
(ignore-errors (kill-buffer buffer))) (ignore-errors (kill-buffer buffer)))
(with-current-buffer (pop-to-buffer buffer) (with-current-buffer buffer
(if (not (eq major-mode 'shell-mode)) (if (not (eq major-mode 'shell-mode))
(shell buffer) (shell buffer)
(cd dir) (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)) (when-let (process (get-buffer-process buffer))
(set-process-sentinel process #'+shell--sentinel) (set-process-sentinel process #'+shell--sentinel)
(+shell--send-input buffer command)))) (+shell--send-input buffer command))))