I have set tramp-persistency-file-name to a custom location since I want all the files generated by emacs stored in a specific location.

(setq files-dir "~/src/emacs.d/vendor/files/")
(setq custom-file (concat files-dir "custom.el")
      tramp-persistency-file-name (concat files-dir "tramp")
      host-file (concat hosts-dir (replace-regexp-in-string "[^A-Za-z0-9_-]" "-" (downcase (car (split-string (system-name) "\\.")))) ".el")
      version-file (concat versions-dir (number-to-string emacs-major-version) ".el"))

I do have some bookmarks set to some remote locations, that are supposed to use tramp to reach some remote files.

So, the "first time" I use it, it works. I can reach my /scp:host:/path remote path and open some files.

Then, Tramp generates the history file in the right location I've set (~/src/emacs.d/vendor/files/tramp).

But the next time, I want to open such a location, it crashes and generates this backtrace:

Debugger entered--Lisp error: (invalid-function (["scp" nil "my-host" nil nil] ("locale" "LC_ALL=en_US.utf8") ("uname" "Linux 3.2.0-4-amd64") ("test" "test") ("remote-path" ("/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin")) ("remote-shell" "/bin/sh") ("stat" "\\stat") ("file-exists" "test -e") ("id" "/usr/bin/id") ("gid-string" "my-user") ("ls" "/bin/ls --color=never") ("ls-dired" t) ("gid-integer" 1016) ("perl-file-spec" t) ("perl-cwd-realpath" t) ("perl" "\\perl") ("readlink" "\\readlink")))
  ((["scp" nil "my-host" nil nil] ("locale" "LC_ALL=en_US.utf8") ("uname" "Linux 3.2.0-4-amd64") ("test" "test") ("remote-path" ("/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin")) ("remote-shell" "/bin/sh") ("stat" "\\stat") ("file-exists" "test -e") ("id" "/usr/bin/id") ("gid-string" "my-user") ("ls" "/bin/ls --color=never") ("ls-dired" t) ("gid-integer" 1016) ("perl-file-spec" t) ("perl-cwd-realpath" t) ("perl" "\\perl") ("readlink" "\\readlink")))
  eval-buffer(#<buffer  *load*> nil "/Users/my-user/src/emacs.d/vendor/files/tramp" nil t)  ; Reading at buffer position 702
  load-with-code-conversion("/Users/my-user/src/emacs.d/vendor/files/tramp" "/Users/my-user/src/emacs.d/vendor/files/tramp" nil t)
  load("tramp" nil t)
  (let ((default-directory (or (symbol-value (quote temporary-file-directory)) "/"))) (load "tramp" nil t))
  tramp-autoload-file-name-handler(expand-file-name "/scp:my-host:/home/my-user/my/path" nil)
  bookmark-default-handler(("MyBookmark" (filename . "/scp:my-host:/home/my-user/my/path")))
  byte-code("\301!\206�\302\303!!\207" [bookmark-name-or-record bookmark-get-handler bookmark-default-handler bookmark-get-bookmark] 3)
  bookmark--jump-via("MyBookmark" switch-to-buffer)
  call-interactively(bookmark-bmenu-this-window nil nil)

Note: if I comment the line setq tramp-persistency-file-name blabla, it solves the problem but the file is located in my emacs.d directory (which I do not want).

Do you have any idea what's going wrong ? Should I report a bug or am I the bug ?

EDIT: as requested here is the tramp file generated after the first use of the feature

;; -*- emacs-lisp -*- <15/12/23 10:35:22 ~/src/emacs.d/vendor/files/tramp>
;; Tramp connection history.  Don't change this file.
;; You can delete it, forcing Tramp to reapply the checks.

((["scp" nil "my-host" nil nil]
  ("locale" "LC_ALL=en_US.utf8")
  ("uname" "Linux 3.2.0-4-amd64")
  ("test" "test")
   ("/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin"))
  ("remote-shell" "/bin/sh")
  ("stat" "\\stat")
  ("file-exists" "test -e")
  ("id" "/usr/bin/id")
  ("gid-string" "my-user")
  ("ls" "/bin/ls --color=never")
  ("ls-dired" t)
  ("gid-integer" 1016)
  ("readlink" "\\readlink")
  ("perl-file-spec" t)
  ("perl-cwd-realpath" t)
  ("perl" "\\perl")))
  • Can you post the contents of /Users/my-user/src/emacs.d/vendor/files/tramp (be careful to remove personal info)? Looks like something is wrong with that file.
    – wvxvw
    Commented Dec 23, 2015 at 9:33
  • Done. But it is generated by tramp, I did not edit it. Thanks for your time anyways
    – PierreL
    Commented Dec 23, 2015 at 9:37
  • Well, the thing is: Emacs is trying to load this file, but loading it means interpreting it as Lisp code, and as such, it is not valid ["scp" ...] is not a function. Does this file look the same if you don't modify the path? (perhaps there's a ' before the first paren, or maybe even more code preceding it?).
    – wvxvw
    Commented Dec 23, 2015 at 9:45
  • Just tried. It does look the same. begins by ((["scp" nil "my-host" nil nil] . Anyway, why would it change the content file by changing its location ? Is there any reason ?
    – PierreL
    Commented Dec 23, 2015 at 9:48
  • From looking at tramp-autoload-file-name-handler there doesn't seem to be any reason for this file to look this way. It just looks like the contents of this file were meant for something else... I'd write to Emacs mailing list to ask why it looks the way it does. On the surface of it, it doesn't make sense.
    – wvxvw
    Commented Dec 23, 2015 at 10:02

1 Answer 1


I believe I understand. Your files-dir is contained in load-path. When Tramp is loaded, Emacs finds the file tramp in this directory and tries to load it instead of tramp.el in its original directory.

Give that file another name but tramp or tramp.el, or locate it in another directory, which is not covered by load-path.

  • Michael, you are my hero.
    – PierreL
    Commented Jan 4, 2016 at 13:09

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.