Variable: auto-save-file-name-transforms
auto-save-file-name-transforms is a customizable variable defined in
files.el.gz.
Value
(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" "/tmp/\\2" t))
Documentation
Transforms to apply to buffer file name before making auto-save file name.
Each transform is a list (REGEXP REPLACEMENT UNIQUIFY):
REGEXP is a regular expression to match against the file name.
If it matches, replace-match is used to replace the
matching part with REPLACEMENT.
If the optional element UNIQUIFY is nil, Emacs does not check for
file name clashes, so using that is not recommended. If UNIQUIFY
is one of the members of secure-hash-algorithms, Emacs
constructs the nondirectory part of the auto-save file name by
applying that secure-hash to the buffer file name. This avoids
any risk of excessively long file names. Finally, if UNIQUIFY is
any other value the auto-save file name is constructed by taking
the directory part of the replaced file-name, concatenated with
the buffer file name with all directory separators changed to !
to prevent clashes. This will not work correctly if your
filesystem truncates the resulting name.
All the transforms in the list are tried, in the order they are listed. When one transform applies, its result is final; no further transforms are tried.
The default value is set up to put the auto-save file into the
temporary directory (see the variable temporary-file-directory(var)/temporary-file-directory(fun)) for
editing a remote file.
On MS-DOS filesystems without long names this variable is always ignored.
This variable was added, or its default value changed, in Emacs 21.1.
Probably introduced at or before Emacs version 22.1.
Source Code
;; Defined in /usr/src/emacs/lisp/files.el.gz
(defcustom auto-save-file-name-transforms
`(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'"
;; Don't put "\\2" inside expand-file-name, since it will be
;; transformed to "/2" on DOS/Windows.
,(concat temporary-file-directory "\\2") t))
"Transforms to apply to buffer file name before making auto-save file name.
Each transform is a list (REGEXP REPLACEMENT UNIQUIFY):
REGEXP is a regular expression to match against the file name.
If it matches, `replace-match' is used to replace the
matching part with REPLACEMENT.
If the optional element UNIQUIFY is nil, Emacs does not check for
file name clashes, so using that is not recommended. If UNIQUIFY
is one of the members of `secure-hash-algorithms', Emacs
constructs the nondirectory part of the auto-save file name by
applying that `secure-hash' to the buffer file name. This avoids
any risk of excessively long file names. Finally, if UNIQUIFY is
any other value the auto-save file name is constructed by taking
the directory part of the replaced file-name, concatenated with
the buffer file name with all directory separators changed to `!'
to prevent clashes. This will not work correctly if your
filesystem truncates the resulting name.
All the transforms in the list are tried, in the order they are listed.
When one transform applies, its result is final;
no further transforms are tried.
The default value is set up to put the auto-save file into the
temporary directory (see the variable `temporary-file-directory') for
editing a remote file.
On MS-DOS filesystems without long names this variable is always
ignored."
:group 'auto-save
:type `(repeat (list (regexp :tag "Regexp")
(string :tag "Replacement")
(choice
(const :tag "Uniquify" t)
,@(mapcar (lambda (algo)
(list 'const algo))
(secure-hash-algorithms)))))
:initialize #'custom-initialize-delay
:version "21.1")