about summary refs log tree commit diff
path: root/tools/emacs-pkgs/term-switcher
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2023-08-08T10·48+0300
committerclbot <clbot@tvl.fyi>2023-08-08T10·52+0000
commitfa8288823b546e627499dcd33281d612a6a15f3a (patch)
tree68878d9940293cd34885cedc1c808d75b02a978b /tools/emacs-pkgs/term-switcher
parent447d9591433a4b26adad8e912fd60cdb90bafd5d (diff)
fix(emacs-pkgs/term-switcher): don't open vterm over tramp r/6470
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>
Diffstat (limited to 'tools/emacs-pkgs/term-switcher')
-rw-r--r--tools/emacs-pkgs/term-switcher/term-switcher.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/emacs-pkgs/term-switcher/term-switcher.el b/tools/emacs-pkgs/term-switcher/term-switcher.el
index 0055f87fd67f..b7e4b049468e 100644
--- a/tools/emacs-pkgs/term-switcher/term-switcher.el
+++ b/tools/emacs-pkgs/term-switcher/term-switcher.el
@@ -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))))