refactor!(:term): toggle commands now always hide

BREAKING CHANGE: previously, <leader> o t commands would only hide the
terminal popup if it was focused. If not, they would move the focus to
the terminal window. This is unintuitive to the "toggle" description,
and arguably less useful, since refocusing to the terminal can be easily
done with regular window refocus commands. Therefore, <leader> o t now
just hides the terminal popup.

Fix #3374
This commit is contained in:
Itai Y. Efrat 2021-09-21 14:57:00 +03:00 committed by Henrik Lissner
parent 7274f73500
commit 7933e54542
4 changed files with 9 additions and 29 deletions

View file

@ -99,14 +99,9 @@
(fundamental-mode)
(erase-buffer))))
(if-let (win (get-buffer-window eshell-buffer))
(if (eq (selected-window) win)
(let (confirm-kill-processes)
(delete-window win)
(ignore-errors (kill-buffer eshell-buffer)))
(select-window win)
(when (bound-and-true-p evil-local-mode)
(evil-change-to-initial-state))
(goto-char (point-max)))
(with-current-buffer (pop-to-buffer eshell-buffer)
(doom-mark-buffer-as-real-h)
(if (eq major-mode 'eshell-mode)

View file

@ -69,15 +69,10 @@ If popup is focused, kill it."
"main"))))
(dir default-directory))
(if-let (win (get-buffer-window buffer))
(if (eq (selected-window) win)
(let (confirm-kill-processes)
(set-process-query-on-exit-flag (get-buffer-process buffer) nil)
(delete-window win)
(ignore-errors (kill-buffer buffer)))
(select-window win)
(when (bound-and-true-p evil-local-mode)
(evil-change-to-initial-state))
(goto-char (point-max)))
(with-current-buffer (pop-to-buffer buffer)
(if (not (eq major-mode 'shell-mode))
(shell buffer)

View file

@ -28,12 +28,7 @@ If prefix ARG, recreate the term buffer."
(setq buffer (multi-term-get-buffer nil t))) ; recreates buffer
(if (and (window-live-p window)
(buffer-live-p buffer))
(if (eq (selected-window) window)
(delete-window window)
(select-window window)
(when (bound-and-true-p evil-local-mode)
(evil-change-to-initial-state))
(goto-char (point-max)))
(setenv "PROOT" (or (doom-project-root) default-directory))
(with-current-buffer buffer
(doom-mark-buffer-as-real-h)

View file

@ -26,12 +26,7 @@ Returns the vterm buffer."
(when (window-live-p window)
(delete-window window))))
(if-let (win (get-buffer-window buffer-name))
(if (eq (selected-window) win)
(delete-window win)
(select-window win)
(when (bound-and-true-p evil-local-mode)
(evil-change-to-initial-state))
(goto-char (point-max)))
(let ((buffer (get-buffer-create buffer-name)))
(with-current-buffer buffer
(unless (eq major-mode 'vterm-mode)