aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Pluim2018-06-01 15:05:23 +0200
committerRobert Pluim2018-06-01 15:06:20 +0200
commit9188291f7a3a2536ef0b694e4c75f3094cf46fcf (patch)
treeade6c263ba1cf79c32b12c738953ff7a4eb2b75d
parente5471b2381e885d5d214bfa09ab0c35275fc6048 (diff)
downloademacs-9188291f7a3a2536ef0b694e4c75f3094cf46fcf.tar.gz
emacs-9188291f7a3a2536ef0b694e4c75f3094cf46fcf.zip
Add detailed documentation about lock files
* 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.
-rw-r--r--doc/emacs/files.texi9
-rw-r--r--doc/lispref/files.texi14
-rw-r--r--src/filelock.c5
3 files changed, 22 insertions, 6 deletions
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 1ced7ca07c6..406e7d980c3 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -766,13 +766,16 @@ file.
766 766
767@findex ask-user-about-lock 767@findex ask-user-about-lock
768@cindex locking files 768@cindex locking files
769@cindex .#, lock file names
770@cindex file locking
769 When you make the first modification in an Emacs buffer that is 771 When you make the first modification in an Emacs buffer that is
770visiting a file, Emacs records that the file is @dfn{locked} by you. 772visiting a file, Emacs records that the file is @dfn{locked} by you.
771(It does this by creating a specially-named symbolic link@footnote{If 773(It does this by creating a specially-named symbolic link@footnote{If
772your file system does not support symbolic links, a regular file is 774your file system does not support symbolic links, a regular file is
773used.} with special contents in the same directory.) Emacs removes the lock 775used.} with special contents in the same directory. @xref{File
774when you save the changes. The idea is that the file is locked 776Locks,,, elisp} for more details.) Emacs removes the lock when you
775whenever an Emacs buffer visiting it has unsaved changes. 777save the changes. The idea is that the file is locked whenever an
778Emacs buffer visiting it has unsaved changes.
776 779
777@vindex create-lockfiles 780@vindex create-lockfiles
778 You can prevent the creation of lock files by setting the variable 781 You can prevent the creation of lock files by setting the variable
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 5137f3a9ab4..6dfca0f2128 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -712,6 +712,7 @@ with-temp-buffer,, The Current Buffer}.
712@section File Locks 712@section File Locks
713@cindex file locks 713@cindex file locks
714@cindex lock file 714@cindex lock file
715@cindex .#, lock file names
715 716
716 When two users edit the same file at the same time, they are likely 717 When two users edit the same file at the same time, they are likely
717to interfere with each other. Emacs tries to prevent this situation 718to interfere with each other. Emacs tries to prevent this situation
@@ -720,8 +721,17 @@ modified.
720Emacs can then detect the first attempt to modify a buffer visiting a 721Emacs can then detect the first attempt to modify a buffer visiting a
721file that is locked by another Emacs job, and ask the user what to do. 722file that is locked by another Emacs job, and ask the user what to do.
722The file lock is really a file, a symbolic link with a special name, 723The file lock is really a file, a symbolic link with a special name,
723stored in the same directory as the file you are editing. (On file 724stored in the same directory as the file you are editing. The name is
724systems that do not support symbolic links, a regular file is used.) 725constructed by prepending @file{.#} to the filename of the buffer.
726The target of the symbolic link will be of the form
727@code{@var{user}@@@var{host}.@var{pid}:@var{boot}}, where @var{user}
728is replaced with the current username (from @code{user-login-name}),
729@var{host} with the name of the host where Emacs is running (from
730@code{system-name}), @var{pid} with Emacs's process id, and @var{boot}
731with the time since the last reboot. @code{:@var{boot}} is omitted if
732the boot time is unavailable. (On file systems that do not support
733symbolic links, a regular file is used instead, with contents of the
734form @code{@var{user}@@@var{host}.@var{pid}:@var{boot}}.)
725 735
726 When you access files using NFS, there may be a small probability that 736 When you access files using NFS, there may be a small probability that
727you and another user will both lock the same file simultaneously. 737you and another user will both lock the same file simultaneously.
diff --git a/src/filelock.c b/src/filelock.c
index f2dc7234076..d33063c8790 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -849,7 +849,10 @@ syms_of_filelock (void)
849 Vtemporary_file_directory = Qnil; 849 Vtemporary_file_directory = Qnil;
850 850
851 DEFVAR_BOOL ("create-lockfiles", create_lockfiles, 851 DEFVAR_BOOL ("create-lockfiles", create_lockfiles,
852 doc: /* Non-nil means use lockfiles to avoid editing collisions. */); 852 doc: /* Non-nil means use lockfiles to avoid editing collisions.
853The name of the (per-buffer) lockfile is constructed by prepending a
854'.#' to the name of the file being locked. See also `lock-buffer' and
855Info node `(emacs)Interlocking'. */);
853 create_lockfiles = 1; 856 create_lockfiles = 1;
854 857
855 defsubr (&Sunlock_buffer); 858 defsubr (&Sunlock_buffer);