Hot answers tagged

15

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 ...


11

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.


10

Using TRAMP multi-hops. For instance, if you want to edit the remote file /root/salary.txt /ssh:homer@powerplant|sudo:powerplant:/root/salary.txt The example is taken from the Mastering Emacs book.


10

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!


7

I would do this outside of Emacs, with a wrapper script that pulls the updated config first. Something like this: #! /bin/sh 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-...


5

What about writing a "safe" version of shell-command that would properly escape arguments using shell-quote-argument ? For example: (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-...


5

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 vc-ignore-dir-regexp (format "%s\\|%s" vc-ignore-dir-regexp tramp-file-name-regexp)) (setq tramp-verbose 1)...


5

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.


4

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 /...


3

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 ...


3

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. /user@myserver.com:/home/user). You can achieve this by setting PS1 (e.g. in the .bashrc file on the remote ...


3

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.


3

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-...


3

You can try qdb https://github.com/quantopian/qdb An emacs interface (qbd.el) is included: https://github.com/quantopian/qdb/tree/master/client/emacs


2

Maybe not satisfactorily, but this issue is on the Tramp wish list. Maybe it will be implemented some day. See the discussion on the Emacs Devel ML http://thread.gmane.org/gmane.emacs.devel/174131


2

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 ...


2

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 () (and (buffer-file-name) (let ((local-path (chomp (shell-command-to-string (concat "df -l \"" (buffer-file-name) "\" | awk '/^...


2

,----[ C-h f url-handler-mode RET ] | url-handler-mode is an interactive autoloaded compiled Lisp function | in `url-handlers.el'. | | (url-handler-mode &optional ARG) | | Toggle using `url' library for URL filenames (URL Handler mode). `----


2

M-x browse-url-emacs RET URL RET


2

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 ...


2

Since I presume you are going to be sshing to these machines, I suggest you can take a look at sshrc which lets you take your local dotfiles along when you ssh into any server.


2

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.


2

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. (require 'crux) (require 's) (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)) ...


2

Your syntax is wrong, it misses the trailing colon. Try C-x C-f /ftp:username@subdomain.hostname.com:


2

If you don't need version control, disable it. (setq vc-handled-backends nil)


2

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.


2

I don't know which Tramp version you use. But in the more recent versions, you can set connection-local variables. Check the Tramp manual for details.


1

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.


1

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.


Only top voted, non community-wiki answers of a minimum length are eligible