diff --git a/core/core-popups.el b/core/core-popups.el index 3ef5216cd..7a17de388 100644 --- a/core/core-popups.el +++ b/core/core-popups.el @@ -396,6 +396,10 @@ the command buffer." (advice-add #'mu4e~temp-window :override #'doom*mu4e-popup-window)) +(after! multi-term + (setq multi-term-buffer-name "doom:terminal")) + + (after! neotree ;; Neotree has its own window/popup management built-in, which is difficult to ;; police. For example, switching perspectives will cause neotree to forget it diff --git a/modules/tools/term/autoload.el b/modules/tools/term/autoload.el index fdeaf2bb2..de0b5a3aa 100644 --- a/modules/tools/term/autoload.el +++ b/modules/tools/term/autoload.el @@ -1,16 +1,28 @@ ;;; tools/term/autoload.el ;;;###autoload -(defun +term () - (interactive) - (call-interactively 'multi-term)) +(defun +term (&optional project-root) + "Open a terminal buffer in the current window. If PROJECT-ROOT (C-u) is +non-nil, cd into the current project's root." + (interactive "P") + (let ((default-directory (if project-root (doom-project-root) default-directory))) + (call-interactively 'multi-term))) ;;;###autoload -(defun +term/popup () - (interactive) +(defun +term/popup (&optional project-root) + "Open a terminal popup window. If PROJECT-ROOT (C-u) is non-nil, cd into the +current project's root." + (interactive "P") (require 'multi-term) - (let* ((buffer (multi-term-get-buffer current-prefix-arg)) - (window (doom-popup-buffer buffer :popup t :align t :size 25 :select t :autokill t :noesc t))) + (let* ((default-directory (if project-root (doom-project-root) default-directory)) + (buffer (multi-term-get-buffer current-prefix-arg)) + (window (doom-popup-buffer buffer))) (select-window window) (setq multi-term-buffer-list (nconc multi-term-buffer-list (list buffer))) (multi-term-internal))) + +;;;###autoload +(defun +term/popup-in-project () + "Open a terminal popup window in the root of the current project." + (interactive) + (+term/popup t)) diff --git a/modules/tools/term/config.el b/modules/tools/term/config.el index 23781599e..345283cac 100644 --- a/modules/tools/term/config.el +++ b/modules/tools/term/config.el @@ -4,4 +4,4 @@ :commands (multi-term multi-term-next multi-term-prev) :config (setq multi-term-program (getenv "SHELL") - multi-term-switch-after-close nil)) + multi-term-switch-after-close 'PREVIOUS))