Is these a function that behaves like file-truename on local files, but does not add the /protocol:host: prefix on remote files? Currently if I run

(file-truename "./file.ext")

while in a remote directory, I get "/ssh:host:/remote/path/file.ext". but I just want "/remote/path/file.ext"

The reason that I am asking is that pdf export in org-mode does not work on remote file for me. I have tracked the problem down to the call (org-latex-compile "./myfile.org") which uses file-truename to produce the actual file name that is supplied to the latex shell call. This causes problems on remote files because the tramp prefix is included in the shell call. I would like to write a patch for this.

  • Did you find a solution to your problem with org -> PDF export? I have the same issue now with remote image files in my org source.
    – Tyler
    Commented Aug 11, 2017 at 21:09

2 Answers 2


The behavior as described by you is the intended one. If you want only the remote pathname, you must call

(file-remote-p (file-truename "./file.ext") 'localname)

(expand-file-name "./file.ext")
=> "/home/brian/file.ext"

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.