• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Mikey Boldt

What am I doing?

  • Home
  • About Mikey
  • Contact

Emacs: ssh with Tab Completion

December 5, 2011 by 1 Comment

Something that’s bugged me is that when I ssh into another machine inside a shell in emacs, tab completion gets still behaves as if I’m on the local machine. Just by chance, I once started a shell when using TRAMP to edit a remote file via scp, and noticed that the shell was on the remote machine and tab completion worked! So, I used this little in a function to start a remote with tab completion without manually opening a file on the remote machine first:

(defun remote-shell (&optional host)
  "Open a remote shell to a host."
  (interactive)
  (with-temp-buffer
    (let ((host (or host (read-string "Host: "))))
      (cd (concat "/scp:" host ":"))
      (shell (concat "*" host "*")))))

(defun myserver-shell () (interactive) (remote-shell "myserver"))

Filed Under: Tech Tagged With: emacs

Reader Interactions

Comments

  1. Steven says

    February 9, 2013 at 1:03 pm

    This is just what I was looking for. Thanks.

    Reply

Leave a Reply to Steven Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • Recover from Blank Screen After Unplugging External Display in XFCE
  • Remove a Key Binding From Emacs Mode
  • Disable Bluetooth on Ubuntu Startup
  • Geequie: Cull Photos on Linux
  • Sync PDFs with Android using Dropsync

Recent Comments

  • Ricardo Orbegozo on Linking to MS Office File in Emacs Org Mode
  • eliaso on Linking to MS Office File in Emacs Org Mode
  • Joao Brito on Linking to MS Office File in Emacs Org Mode
  • Unable to install Emacs 24 from ppa:cassou/emacs | Ubuntu InfoUbuntu Info on Install Emacs 24 in Ubuntu
  • Unable to install Emacs 24 from ppa:cassou/emacs | WyldePlayground.netWyldePlayground.net - on Install Emacs 24 in Ubuntu

Copyright © 2025 · Mikey Boldt Theme on Genesis Framework · WordPress · Log in