Turns out it was projectile that was causing the problems. As soon as I disabled projectile-mode TRAMP was buttery smooth and I began to understand the hype behind it.
Hopefully this helps out someone else who has exhausted all other options.
Another solution I found if you don't want to disable projectile constantly is to put this command in your init.el
auto-revert-tail-mode is great, but it has its limits. Therefore I prefer to use an asynchronous shell command. Open the remote directory in dired, position the cursor to the file you want to watch, and apply ! tail -f * &.
If you want to suppress Tramp messages, decrease the verbosity. (setq tramp-verbose 1) shall be sufficient.
The equivalent of the git command in Magit is to set a new Remote.
This is where it is in the docs
Ma creates a new remote.
When asked for the name of your remote, the usual answer is the name of your remote server, typically 'origin'
I hope this saves someone some time!
I would do this outside of Emacs, with a wrapper script that pulls the updated config first.
Something like this:
cd ~/.emacs.d && git pull --rebase
exec /usr/bin/emacs "$@"
Then make this executable, name it emacs, and put it on your PATH before the real one.
Another option would be to have init.el do pretty much the same thing: (call-...
What about writing a "safe" version of shell-command that would properly escape arguments using shell-quote-argument ?
(defun safe-shell-command (args &optional output-buffer error-buffer)
(apply 'shell-command (mapconcat 'shell-quote-argument args " ")
output-buffer error-buffer nil))
(the same would easily apply to async-...
There is Tramp. You can edit a file on another machine using the syntax /ssh:user@machine:/path/to/file. If you take sudo instead of ssh, and empty user and machine, you can edit a local file as root. Like /sudo::/path/to/file.
I have also found the solutions on the tramp FAQ that address speeding tramp up to work pretty well.
From the page, here is what I added to my configuration:
(setq remote-file-name-inhibit-cache nil)
(setq tramp-verbose 1)...
If I understand your question correctly, the simplest solution that I have found is to set the variable directory-abbrev-alist to map directories in the compilation buffer to the host system.
For example I run my phpunit tests in a docker container as a compile command. When there are errors or failures the filepaths in the compilation buffer show up as /...
Not the best solution, but certainly a working one: Use [dirtrack-mode]. The following preparations are needed:
1. On the remote machine:
Make sure the prompt of the remote shell contains the path including the server login in TRAMP notation (e.g. /firstname.lastname@example.org:/home/user). You can achieve this by setting PS1 (e.g. in the .bashrc file on the remote ...
You might be thinking about impatient-mode, which is available in MELPA, and also on GitHub. I haven't tried it myself, but according to Sacha Chua's blog post about it it seems to be easy to use:
Install the impatient-mode package.
Call M-x httpd-start.
Configure the firewall to allow incoming connections.
Put the selected buffer into impatient-...
Tramp works on the basis of default-directory. If you run a shell in Emacs, and you perform ssh in that shell, the buffers's default-directory is still the local path the shell was started from. You have three options to adapt default-directory:
Start the shell while you are visiting a remote file or directory. The shell doesn't run on your local host, but ...
If you simply want to know whether the file is accessed through a remote acces method, you can call file-remote-p (built into Emacs) or Tramp's similar function tramp-handle-file-remote-p. Both functions return nil for an actual file name and the method prefix (as a string) for a file accessed through a remote method.
This may or may not be what you're ...
I realize you're asking to detect tramp buffers vs, say, files on a remote mounted filesystem, but for posterity this might be useful to other searchers:
(defun buffer-is-on-local-fs-p ()
(let ((local-path (chomp (shell-command-to-string
(concat "df -l \"" (buffer-file-name) "\" | awk '/^...
No, You can't use a remote virtual environment with emacs with elpy as of now.
Here is jorgenschaefer the author of elpy) comments on this
I'm afraid that won't work. Tramp does a lot of magic with Emacs internals to do what it does, but it breaks in interesting ways if you try to tweak it too far. Elpy does that, because it runs so many different processes ...
Your $PATH settings in your init file are not taken into account per default. Try the following:
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
See also the Tramp manual discussing this setting.
Make sure that dired-dwim-target is set to t, split the frame in two windows, open a local directory in the other window with dired where you want the copy to land, mark the file that you want to copy with C on the remote directory, check that the destination is correctly set to the local directory and press RET.
I wrote a command for automating @Manuel Uberti's answer. The second one is the one I'd use. It uses the first one for remote files and uses crux for local files.
(defun my--reopen-remote-file-as-root ()
"Reopen a remote file as root over tramp."
(find-alternate-file (let* ((parts (s-split ":" buffer-file-name))
I found out what my particular problem was.
The server I'm trying to login to, displays a fancy motd message when logging in. This ascii-art contains some characters that emacs/tramp seems to dislike, probably backslashes/slashes.
In the end I just removed the motd message and everything is fine now.
Emacs saves files by creating a new file with a temporary name, deleting the old file, and then renaming the new file to the correct name. This is less error-prone; you won't end up with content from the new and old files mixed together if there's an error during writing. Check that you have permission to create files in that directory on the remote machine.
Have you installed cygwin on the remote machine? Windows doesn't have a native ssh server (although Windows 10 has recently introduced a beta).
If not, you may want to look at the instructions for installing cygwin and running a ssh server on the remote machine.
I found the solution by using ssh_config, which allows you to bypass all concern about escaping; you just enter your login name in your ~/.ssh/config file and tramp will respect it. I posted full details here: http://www.toryanderson.com/tech/escaped-log-ins-tramp
I solved this with the following overloaded function:
(defun cd (dir)
"Make DIR become the current buffer's default directory.
If your environment includes a `CDPATH' variable, try each one of
that list of directories (separated by occurrences of
`path-separator') when resolving a relative directory name.
The path separator is colon in GNU and GNU-like ...