]> git.eshelyaron.com Git - emacs.git/commitdiff
Add detailed documentation about lock files
authorRobert Pluim <rpluim@gmail.com>
Fri, 1 Jun 2018 13:05:23 +0000 (15:05 +0200)
committerRobert Pluim <rpluim@gmail.com>
Fri, 1 Jun 2018 13:06:20 +0000 (15:06 +0200)
* doc/emacs/files.texi (Interlocking): Point user at detailed
file locking description in lisp reference manual.  Add index
entry for '.#' to improve disoverability of information about locking.

* doc/lispref/files.texi (File Locks): Describe in detail what
the form of the lock file is.  Add index entry for '.#' to
improve disoverability of information about locking.

* src/filelock.c (create-lockfiles): Add cross reference to
file locking in user manual and to 'lock-buffer'.  Add string
'.#' to help users find the doc string.

doc/emacs/files.texi
doc/lispref/files.texi
src/filelock.c

index 1ced7ca07c6b44d91dc29be4a16ccac1106f1599..406e7d980c37dd8423fae284777205be67da1bb8 100644 (file)
@@ -766,13 +766,16 @@ file.
 
 @findex ask-user-about-lock
 @cindex locking files
+@cindex .#, lock file names
+@cindex file locking
   When you make the first modification in an Emacs buffer that is
 visiting a file, Emacs records that the file is @dfn{locked} by you.
 (It does this by creating a specially-named symbolic link@footnote{If
 your file system does not support symbolic links, a regular file is
-used.} with special contents in the same directory.)  Emacs removes the lock
-when you save the changes.  The idea is that the file is locked
-whenever an Emacs buffer visiting it has unsaved changes.
+used.} with special contents in the same directory. @xref{File
+Locks,,, elisp} for more details.)  Emacs removes the lock when you
+save the changes.  The idea is that the file is locked whenever an
+Emacs buffer visiting it has unsaved changes.
 
 @vindex create-lockfiles
   You can prevent the creation of lock files by setting the variable
index 5137f3a9ab4a9c573b2539be4de2760eadbe32f9..6dfca0f2128a15dac7262ffcfca7ed59eee469c8 100644 (file)
@@ -712,6 +712,7 @@ with-temp-buffer,, The Current Buffer}.
 @section File Locks
 @cindex file locks
 @cindex lock file
+@cindex .#, lock file names
 
   When two users edit the same file at the same time, they are likely
 to interfere with each other.  Emacs tries to prevent this situation
@@ -720,8 +721,17 @@ modified.
 Emacs can then detect the first attempt to modify a buffer visiting a
 file that is locked by another Emacs job, and ask the user what to do.
 The file lock is really a file, a symbolic link with a special name,
-stored in the same directory as the file you are editing.  (On file
-systems that do not support symbolic links, a regular file is used.)
+stored in the same directory as the file you are editing.  The name is
+constructed by prepending @file{.#} to the filename of the buffer.
+The target of the symbolic link will be of the form
+@code{@var{user}@@@var{host}.@var{pid}:@var{boot}}, where @var{user}
+is replaced with the current username (from @code{user-login-name}),
+@var{host} with the name of the host where Emacs is running (from
+@code{system-name}), @var{pid} with Emacs's process id, and @var{boot}
+with the time since the last reboot.  @code{:@var{boot}} is omitted if
+the boot time is unavailable.  (On file systems that do not support
+symbolic links, a regular file is used instead, with contents of the
+form @code{@var{user}@@@var{host}.@var{pid}:@var{boot}}.)
 
   When you access files using NFS, there may be a small probability that
 you and another user will both lock the same file simultaneously.
index f2dc723407698031366ea63f60ac2dd7cf38dacc..d33063c8790819f59061773f1d00cb7cb0e69ac9 100644 (file)
@@ -849,7 +849,10 @@ syms_of_filelock (void)
   Vtemporary_file_directory = Qnil;
 
   DEFVAR_BOOL ("create-lockfiles", create_lockfiles,
-              doc: /* Non-nil means use lockfiles to avoid editing collisions.  */);
+              doc: /* Non-nil means use lockfiles to avoid editing collisions.
+The name of the (per-buffer) lockfile is constructed by prepending a
+'.#' to the name of the file being locked.  See also `lock-buffer' and
+Info node `(emacs)Interlocking'.  */);
   create_lockfiles = 1;
 
   defsubr (&Sunlock_buffer);