fix(emacs-pkgs/term-switcher): apply tramp workaround to first vterm

Change-Id: Idc01001856cb01104c20b62dc4221c0ad2ab7a3f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9153
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2023-08-25 18:29:50 +03:00 committed by clbot
parent a3dbb60213
commit 6d5d96ecea

View file

@ -27,15 +27,18 @@
:type '(string) :type '(string)
:group 'term-switcher) :group 'term-switcher)
(defun ts/create-vterm ()
"Launch vterm, but don't open semi-broken vterms over TRAMP."
(if (file-remote-p default-directory)
(let ((default-directory "~"))
(vterm))
(vterm)))
(defun ts/open-or-create-vterm (buffer) (defun ts/open-or-create-vterm (buffer)
"Switch to the terminal in BUFFER, or create a new one if buffer is nil." "Switch to the terminal in BUFFER, or create a new one if buffer is nil."
(if buffer (if buffer
(switch-to-buffer buffer) (switch-to-buffer buffer)
;; Don't open semi-broken vterms over tramp. (ts/create-vterm)))
(if (file-remote-p default-directory)
(let ((default-directory "~"))
(vterm))
(vterm))))
(defun ts/is-vterm-buffer (buffer) (defun ts/is-vterm-buffer (buffer)
"Determine whether BUFFER runs a vterm." "Determine whether BUFFER runs a vterm."
@ -55,6 +58,6 @@
:require-match t :require-match t
:action (lambda (match) :action (lambda (match)
(ts/open-or-create-vterm (cdr (assoc match terms))))) (ts/open-or-create-vterm (cdr (assoc match terms)))))
(vterm)))) (ts/create-vterm))))
(provide 'term-switcher) (provide 'term-switcher)