Fix vterm module after upgrade to emacs 28

This commit is contained in:
Wojciech Kozlowski 2022-08-14 00:39:46 +02:00
parent cdf40a6f9b
commit 742ace250d

View File

@ -37,13 +37,15 @@ Returns the vterm buffer"
(unless (fboundp 'module-load) (unless (fboundp 'module-load)
(user-error (user-error
"Your build of Emacs lacks dynamic modules support and cannot load vterm")) "Your build of Emacs lacks dynamic modules support and cannot load vterm"))
(require 'vterm)
(let ((vterm-buffer-name (+vterm--buffer-name))) (let ((vterm-buffer-name (+vterm--buffer-name)))
(if (string= major-mode "vterm-mode") (if (string= major-mode "vterm-mode")
(funcall spawn-fn vterm-buffer-name) (funcall spawn-fn vterm-buffer-name)
(let ((existing-vterm (+vterm--get-existing-buffer))) (let ((existing-vterm (+vterm--get-existing-buffer)))
(if existing-vterm (if existing-vterm
(funcall switch-fn existing-vterm) (funcall switch-fn existing-vterm)
(funcall spawn-fn vterm-buffer-name)))))) (funcall spawn-fn vterm-buffer-name)))))
)
(defun +vterm--spawn-or-switch-with-project (spawn-fn switch-fn) (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. "Open with `spawn-fn' or switch to active vterm with `switch-fn' in a project.