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)
(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'.