diff options
| author | Robert Pluim | 2018-06-01 15:05:23 +0200 |
|---|---|---|
| committer | Robert Pluim | 2018-06-01 15:06:20 +0200 |
| commit | 9188291f7a3a2536ef0b694e4c75f3094cf46fcf (patch) | |
| tree | ade6c263ba1cf79c32b12c738953ff7a4eb2b75d | |
| parent | e5471b2381e885d5d214bfa09ab0c35275fc6048 (diff) | |
| download | emacs-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.texi | 9 | ||||
| -rw-r--r-- | doc/lispref/files.texi | 14 | ||||
| -rw-r--r-- | src/filelock.c | 5 |
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 |
| 770 | visiting a file, Emacs records that the file is @dfn{locked} by you. | 772 | visiting 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 |
| 772 | your file system does not support symbolic links, a regular file is | 774 | your file system does not support symbolic links, a regular file is |
| 773 | used.} with special contents in the same directory.) Emacs removes the lock | 775 | used.} with special contents in the same directory. @xref{File |
| 774 | when you save the changes. The idea is that the file is locked | 776 | Locks,,, elisp} for more details.) Emacs removes the lock when you |
| 775 | whenever an Emacs buffer visiting it has unsaved changes. | 777 | save the changes. The idea is that the file is locked whenever an |
| 778 | Emacs 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 |
| 717 | to interfere with each other. Emacs tries to prevent this situation | 718 | to interfere with each other. Emacs tries to prevent this situation |
| @@ -720,8 +721,17 @@ modified. | |||
| 720 | Emacs can then detect the first attempt to modify a buffer visiting a | 721 | Emacs can then detect the first attempt to modify a buffer visiting a |
| 721 | file that is locked by another Emacs job, and ask the user what to do. | 722 | file that is locked by another Emacs job, and ask the user what to do. |
| 722 | The file lock is really a file, a symbolic link with a special name, | 723 | The file lock is really a file, a symbolic link with a special name, |
| 723 | stored in the same directory as the file you are editing. (On file | 724 | stored in the same directory as the file you are editing. The name is |
| 724 | systems that do not support symbolic links, a regular file is used.) | 725 | constructed by prepending @file{.#} to the filename of the buffer. |
| 726 | The target of the symbolic link will be of the form | ||
| 727 | @code{@var{user}@@@var{host}.@var{pid}:@var{boot}}, where @var{user} | ||
| 728 | is 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} | ||
| 731 | with the time since the last reboot. @code{:@var{boot}} is omitted if | ||
| 732 | the boot time is unavailable. (On file systems that do not support | ||
| 733 | symbolic links, a regular file is used instead, with contents of the | ||
| 734 | form @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 |
| 727 | you and another user will both lock the same file simultaneously. | 737 | you 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. |
| 853 | The 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 | ||
| 855 | Info node `(emacs)Interlocking'. */); | ||
| 853 | create_lockfiles = 1; | 856 | create_lockfiles = 1; |
| 854 | 857 | ||
| 855 | defsubr (&Sunlock_buffer); | 858 | defsubr (&Sunlock_buffer); |