6

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?

User1
  • 39,458
  • 69
  • 187
  • 265
  • Have you tried emacs-server? http://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html – zdav Oct 29 '10 at 16:33
  • Yes. From what I understand, it requires that I actually shell into remote the machine and run emacsclient from there. Good idea in some cases, but TRAMP is better for my needs. – User1 Oct 29 '10 at 17:27

1 Answers1

10

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.

DomQ
  • 4,184
  • 38
  • 37
Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
  • 2
    You can set it to `^$`, IIRC. – phils Oct 30 '10 at 05:13
  • Yes! That was totally to cause. I can kind of see why this is the default because loading tramp files is slow. – User1 Oct 30 '10 at 13:46
  • @User1 There are other desktop-like packages that deal with the delayed loading. I thought there was even an addition to desktop itself which did the lazy loading. Many are listed here: http://www.emacswiki.org/emacs/SessionManagement – Trey Jackson Oct 30 '10 at 15:20
  • The "Sep 10 '16 at 11:47" edit of this answer by @DomQ changed the variable to change from `desktop-files-not-to-save` to `desktop-buffers-not-to-save`. However, for me in Emacs 25.2.1 I do have to set `desktop-files-not-to-save` (not `desktop-buffers-not-to-save`) in order to preserve TRAMP files. – tschwinge Nov 16 '17 at 10:51
  • This is not fully tested, but I believe that the solution posted above does not work on my MacBook. However it did work when I added the command mentioned in the comment above. Consider change solution to the following? ```(setq desktop-buffers-not-to-save "^$") (setq desktop-files-not-to-save "^$")``` (two separate lines) – Philip Maybank Nov 01 '21 at 15:02