Emacs desktop doesn't remember TRAMP connections? - emacs

I use emacs to edit scripts and code files on several different servers. TRAMP is working very well. However, when I exit emacs, all my tramp connections go away. I tried desktop-save-mode, but only local files show up when I restart emacs. Is there some package that will remember tramp connections? Is this just a configuration issue?

You can customize the variable desktop-buffers-not-to-save to do this:
(setq desktop-buffers-not-to-save "^$")
By default it is set to a regexp that matches TRAMP filenames. I would have expected setting it to nil would have worked, but, alas, it does not.

Related

Tramp can not connect to remote server

I have upgraded my emacs and updated some el-get packages including tramp (my system is a bit old, and I could not upgrade some emacs packages), and now I can not use tramp to connect to a remote server:
Tramp: Opening connection for server1 using ssh...failed
byte-code: Host `server1' looks like a remote host, `ssh' can only use the local host
I am using tramp version 2.2.13-pre and emacs version 24.5.1. I have compiled emacs myself, in case it matters.
What can be going wrong? What could I try?
EDIT
I am calling tramp like this:
C-x C-f /user#server1:filename
Call emacs -Q. Likely, Tramp will work then. In this case, bisect your .emacs file and restart Emacs, until you find the package which causes the trouble.
One package which didn't cooperate well with Tramp was projectile. Disable it, when you are using it.

emacs shortcuts are not working

I've been trying to get tramp to work for Emacs and was having some problems so I upgraded my Aquamacs to the latest version. Ever since then I've had massive problems with shortcuts. C-x C-f no longer works as find-file and instead does next-buffer. If I try to remap it back to find-file in my .emacs file it still doesn't work. Though I have managed to map C-x C-o to find-file temporarily. Several other shortcuts are also broken inexplicably (with no sign of anything in my .emacs file). I've tried deleting my .emacs file completely, but it doesn't refresh back to the original shortcuts though I do know that it is reading that file because when I do make some changes ( such as C-x C-o mapped to find-file) it does reflect this. However, even when I delete the .emacs file it still keeps the color-face I chose in it.
It's also giving me problems with tramp still in that I get the following error even though I can ssh to the exact same remote host just fine when using a shell window inside of Aquamacs:
"ssh: Could not resolve hostname ssh: nodename nor servname provided, or not known. Process tramp/ssh ssh exited abnormally with code 255"
I've tried reverting to older versions of Aquamacs, deleting the application and reinstalling, but nothing seems to work. Any advice would be greatly appreciated.
Mac OS X 10.6.8, Aquamacs 2.4 Emacs 23.50.1.

Emacs Tramp unable to open directory at times

Normally I am able to use tramp just fine to edit files and browse through the remote file system through SSH. Though at seemingly random times I would lose the ability to browse remote folders in emacs.
I get the error message:
Wrong type argument: number-or-marker-p, //DIRED-OPTIONS//
I've tried doing a clean reinstall of emacs without any customizations and the error still happens.
Also sometimes the error happens after browsing 1 or 2 directories while other times I'm able to do five or six directories before the error will appear.
Edit:
I'm using Emacs 23.3 running on OS X 10.6.8
Edit 2:
While I'm still going through the tramp debug log A couple of other pieces of information.
After the error I'm still able to use tramp of open and save files, just not view directory listings.
It seems to happen only when I save to a directory that is version controlled using git.
In the debug log the directory contents are listed out but it is not being outputted to the user
The directory listing inside the debug log show ^M (I usually notice this in the emacs info bar when editing files that have been versioned in git) even when I try to access a non-version controlled directory
The message is useless by itself. You should try to obtain more traces on the tramp behavior in order to find where is the issue. See the Traces and Profiles Section of the TRAMP User Manual.
Sorry to not help more but with another release on another platform…
Update:
Put the following in your emacs file
(require 'tramp)
(setq tramp-verbose 10)
(setq tramp-debug-buffer t)
Then, use tramp. Now, You should have a *debug tramp/method hostname* buffer.
I found out that this happens when I enable:
(setq-default dired-omit-mode t)
But for now I don't know how to make it work with this mode

Emacs: How to view sftp folders

I'm running Ubuntu and playing with Emacs for the first time but unfortunately it doesn't seem to see any sftp folders I currently have mounted. These folder are visible to nautilus and gedit.
Can any experienced emac users point me in the right direction?
I'm not sure how to get Emacs to pick up specifically those servers that have been mounted under Nautilus.
However (and hopefully this meets your needs), you can still view and edit remote files and directories using Tramp if you know the server name:
C-x C-f /sftp:username#server.net:path/to/file.txt RET
or
C-x C-f /sftp:username#server.net:path/to/directory/ RET
Tramp documentation
Although tramp is more efficient, you can "drag and drop" it from $HOME/.gvfs/server.net/ into emacs. $HOME/.gvfs/server.net/ is where it's mounted locally.
Typically I drop the file into scratch where (as you've seen) it's expanded to a filename. Just modify that into an evaluatable function, evaluate it with "C-M-x":
(find-file "/sftp:username#server.net:/path/to/file.txt")

Stop tramp-mode running on emacs' startup

I was trying out tramp-mode, but now I cannot seem to get rid of it.. Whenever I start emacs, it spends about 20 seconds going through various tramp-related initialisations..
tramp: Waiting 60s for prompt from remote shell
tramp: Setting up remote shell environment
..and so on.
How on earth do I unload tramp? grep'ing my ~/.emacs.d found nothing aside from the plugin itself (which doesn't seem to be loaded anywhere..)
I've cleared the recent-files history, but that made no difference..
Aha, I found where tramp was being loaded:
Loading /Users/dbr/.recentf...done
Loading tramp-mode..
I had a two files in my ~/.recentf file-history which were opened with tramp, removing them stops tramp from loading..
I just found this section of the emacs wiki explaining the problem,
When using TrampMode with recentf.el, it’s advisable to turn off the cleanup feature of recentf that attempts to stat all the files and remove them from the recently accessed list if they are readable. Tramp means that this requires recentf to open up a remote site which will block your emacs process at the most inopportune times.
(require 'recentf)
(setq recentf-auto-cleanup 'never) ;; disable before we start recentf!
(recentf-mode 1)
Another possibility is a listing in ~/.ido.last, if you are using ido-mode. In that case, the remedy is just "rm ~/.ido.last".
It sounds to me like you have a file that is opened via tramp and is being reopened at startup. Have to set emacs to restore your session?
From the tramp faq:
How can I disable tramp?
Shame on you, why did you read until now?
If you just want to have Ange-FTP as default remote files access package, you should > apply the following code:
(setq tramp-default-method "ftp")
Unloading tramp can be achieved by applying M-x tramp-unload-tramp. This resets also > the Ange-FTP plugins.
Note that I haven't tried this but hope it works for you!