18.3.5 Shadowing Files
You can arrange to keep identical shadow copies of certain
files in more than one place—possibly on different machines. To do
this, first you must set up a shadow file group, which is a set
of identically-named files shared between a list of sites. The file
group is permanent and applies to further Emacs sessions as well as
the current one. Once the group is set up, every time you exit Emacs,
it will copy the file you edited to the other files in its group. You
can also do the copying without exiting Emacs, by typing M-x shadow-copy-files
.
A shadow cluster is a group of hosts that share directories, so
that copying to or from one of them is sufficient to update the file
on all of them. Each shadow cluster has a name, and specifies the
network address of a primary host (the one we copy files to), and a
regular expression that matches the host names of all the other hosts
in the cluster. You can define a shadow cluster with M-x shadow-define-cluster
.
M-x shadow-initialize
Set up file shadowing.
M-x shadow-define-literal-group
Declare a single file to be shared between sites.
M-x shadow-define-regexp-group
Make all files that match each of a group of files be shared between hosts.
M-x shadow-define-cluster RET name RET
Define a shadow file cluster name.
M-x shadow-copy-files
Copy all pending shadow files.
M-x shadow-cancel
Cancel the instruction to shadow some files.
To set up a shadow file group, use M-x shadow-define-literal-group
or M-x shadow-define-regexp-group
. See their documentation strings for
further information.
Before copying a file to its shadows, Emacs asks for confirmation.
You can answer “no” to bypass copying of this file, this time. If
you want to cancel the shadowing permanently for a certain file, use
M-x shadow-cancel
to eliminate or change the shadow file group.
File Shadowing is not available on MS Windows.