fix(emacs-pkgs/term-switcher): don't open vterm over tramp

vterm doesn't really seem to support this, but it also doesn't stop
the user from doing it, resulting in weirdly broken terminals.

Change-Id: I5251306a2fb72e7aae4e6c70e522bad240222301
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9017
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2023-08-08 13:48:31 +03:00 committed by clbot
parent 447d959143
commit fa8288823b

View file

@ -1,8 +1,9 @@
;;; term-switcher.el --- Easily switch between open vterms
;;
;; Copyright (C) 2019 Google Inc.
;; Copyright (C) 2019-2020 Google Inc.
;; Copyright (C) 2021-2023 The TVL Authors
;;
;; Author: Vincent Ambo <tazjin@google.com>
;; Author: Vincent Ambo <tazjin@tvl.su>
;; Version: 1.1
;; Package-Requires: (dash ivy s vterm)
;;
@ -30,7 +31,11 @@
"Switch to the buffer with BUFFER-NAME or create a new vterm
buffer."
(if (equal "New vterm" buffer-name)
(vterm)
;; Don't open semi-broken vterms over tramp.
(if (file-remote-p default-directory)
(let ((default-directory "~"))
(vterm))
(vterm))
(if-let ((buffer (get-buffer buffer-name)))
(switch-to-buffer buffer)
(error "Could not find vterm buffer: %s" buffer-name))))