8

I have noticed that opening a tramp connection on remote hosts sometimes created a .tramp_history file in the user's directory. Is there any way to disable such a behavior? I have to log in to many boxes and that's a lot of cleanup to do. No such options seem to be available in the tramp customization group.

The solution might certainly involve some lisp, but my skills are so far very limited... Thanks for your help!

PS: the same question was asked in 2011, see http://lists.gnu.org/archive/html/help-gnu-emacs/2011-01/msg00875.html...

0

2 Answers 2

8

In recent Tramp versions, there is the variable tramp-histfile-override. You can override its default value.

4
  • How about elaborating a bit? How does this help answer the question?
    – Drew
    Jun 6, 2015 at 22:16
  • 5
    The docstring explains this a little bit. (setq tramp-histfile-override "/dev/null") would avoid writing Tramp specific entries in a remote history file. However, there is an error in some bash versions which would give undesired results. Therefore, Tramp uses the default value ".tramp_history". Jun 7, 2015 at 13:26
  • Is there anything else we need to do besides changing this value in tramp/lisp/tramp-sh.el and reloading init.el? Do we need to recompile anything?
    – Andrew
    Mar 16, 2017 at 16:56
  • Setting tramp-histfile-override shall be sufficient. It will be taken for every new connection. Mar 18, 2017 at 8:23
1

The value of the variable tramp-persistency-file-name is used by tramp-dump-connection-properties and is also hard-coded into settings that load initially with tramp-cache.el. I would suggest changing the name/location to /tmp/.tramp or something of that nature if you don't want to ever see it. There is no user option to turn it off completely. Of course, the /tmp directory on some operating systems is emptied out each time the computer is started -- so bear that in mind when choosing a location. A better idea is to set up folders for certain files that Emacs needs and store them in there.

(require 'tramp-cache)
(setq tramp-persistency-file-name "/tmp/.tramp")
1
  • Thanks for your comment. I'm wondering if this file is absolutly necessary for tramp to function correctly (will be able to test later this weekend)... and if it could be redirected to /dev/null. Jun 5, 2015 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.