One of my main reasons for using Emacs is to get a powerful environment after sshing into a remote machine. The first thing I do after starting Emacs is to run M-x shell to get a command line. As it takes a little while for Emacs to start it would be very convenient to have an option to ask Emacs to start a shell when I run it, after parsing my initialization file (I have some shell hooks set up to do one thing and another). Ideally I'd like to be able to run it with an additional option so I wouldn't have to add anything specific to my initialization file on the remote machines (I could set up a bash alias if I wanted to). Something like this:
emacs afile1 afile2 -startShell In fact, given that establishing the secure connection takes about 30 seconds, what I'd really like to do is build the "start a shell" into the ssh command itself, using ssh with -t to start a screen-based program.
ssh -t me@remote emacs afile1 afile2 -startShell I took a look at the command line arguments documentation for Emacs but I'm still starting out on Emacs and Lisp and customization and it wasn't immediately obvious how to proceed to deal with command line arguments. How would I go about doing this?
(Related question on eshell mentioned by user @Name.)
ssh -t me@remote 'emacs -f shell'works like a dream.