~/foo/bar, I can get
/Users/sds/foo/bar, how do I get
Use case: I want to copy a file between computers and they have different physical paths to my home directory.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
C-h f says:
abbreviate-file-name is a compiled Lisp function in `files.el'. (abbreviate-file-name FILENAME) Return a version of FILENAME shortened using `directory-abbrev-alist`. This also substitutes "~" for the user's home directory (unless the home directory is a root directory) and removes automounter prefixes (see the variable `automount-dir-prefix`).
See also the Elisp manual, node Directory Names.