diff --git a/modules/term/vterm/autoload.el b/modules/term/vterm/autoload.el index f28f7d8..84663e9 100644 --- a/modules/term/vterm/autoload.el +++ b/modules/term/vterm/autoload.el @@ -37,13 +37,15 @@ Returns the vterm buffer" (unless (fboundp 'module-load) (user-error "Your build of Emacs lacks dynamic modules support and cannot load vterm")) + (require 'vterm) (let ((vterm-buffer-name (+vterm--buffer-name))) - (if (string= major-mode "vterm-mode") - (funcall spawn-fn vterm-buffer-name) - (let ((existing-vterm (+vterm--get-existing-buffer))) - (if existing-vterm - (funcall switch-fn existing-vterm) - (funcall spawn-fn vterm-buffer-name)))))) + (if (string= major-mode "vterm-mode") + (funcall spawn-fn vterm-buffer-name) + (let ((existing-vterm (+vterm--get-existing-buffer))) + (if existing-vterm + (funcall switch-fn existing-vterm) + (funcall spawn-fn vterm-buffer-name))))) +) (defun +vterm--spawn-or-switch-with-project (spawn-fn switch-fn) "Open with `spawn-fn' or switch to active vterm with `switch-fn' in a project. @@ -54,7 +56,7 @@ Returns the vterm buffer" (user-error "vterm/project cannot find a project, because you are not in a project")) (let ((default-directory project-root)) - (+vterm--spawn-or-switch spawn-fn switch-fn)))) + (+vterm--spawn-or-switch spawn-fn switch-fn)))) (defun +vterm--other-window (other-window-fn current-window-fn) "Open or switch with `other-window-fn'.