646 |
@section File Locks |
@section File Locks |
647 |
@cindex file locks |
@cindex file locks |
648 |
|
|
649 |
When two users edit the same file at the same time, they are likely to |
When two users edit the same file at the same time, they are likely |
650 |
interfere with each other. Emacs tries to prevent this situation from |
to interfere with each other. Emacs tries to prevent this situation |
651 |
arising by recording a @dfn{file lock} when a file is being modified. |
from arising by recording a @dfn{file lock} when a file is being |
652 |
|
modified. (File locks are not implemented on Microsoft systems.) |
653 |
Emacs can then detect the first attempt to modify a buffer visiting a |
Emacs can then detect the first attempt to modify a buffer visiting a |
654 |
file that is locked by another Emacs job, and ask the user what to do. |
file that is locked by another Emacs job, and ask the user what to do. |
655 |
The file lock is really a file, a symbolic link with a special name, |
The file lock is really a file, a symbolic link with a special name, |
681 |
This function locks the file @var{filename}, if the current buffer is |
This function locks the file @var{filename}, if the current buffer is |
682 |
modified. The argument @var{filename} defaults to the current buffer's |
modified. The argument @var{filename} defaults to the current buffer's |
683 |
visited file. Nothing is done if the current buffer is not visiting a |
visited file. Nothing is done if the current buffer is not visiting a |
684 |
file, or is not modified. |
file, or is not modified, or if the system does not support locking. |
685 |
@end defun |
@end defun |
686 |
|
|
687 |
@defun unlock-buffer |
@defun unlock-buffer |
688 |
This function unlocks the file being visited in the current buffer, |
This function unlocks the file being visited in the current buffer, |
689 |
if the buffer is modified. If the buffer is not modified, then |
if the buffer is modified. If the buffer is not modified, then |
690 |
the file should not be locked, so this function does nothing. It also |
the file should not be locked, so this function does nothing. It also |
691 |
does nothing if the current buffer is not visiting a file. |
does nothing if the current buffer is not visiting a file, or if the |
692 |
|
system does not support locking. |
693 |
@end defun |
@end defun |
694 |
|
|
695 |
File locking is not supported on some systems. On systems that do not |
File locking is not supported on some systems. On systems that do not |
836 |
@c Emacs 19 feature |
@c Emacs 19 feature |
837 |
@defun file-accessible-directory-p dirname |
@defun file-accessible-directory-p dirname |
838 |
This function returns @code{t} if you have permission to open existing |
This function returns @code{t} if you have permission to open existing |
839 |
files in the directory whose name as a file is @var{dirname}; otherwise |
files in the directory whose name as a file is @var{dirname}; |
840 |
(or if there is no such directory), it returns @code{nil}. The value |
otherwise (or if there is no such directory), it returns @code{nil}. |
841 |
of @var{dirname} may be either a directory name or the file name of a |
The value of @var{dirname} may be either a directory name (such as |
842 |
file which is a directory. |
@file{/foo/}) or the file name of a file which is a directory |
843 |
|
(such as @file{/foo}, without the final slash). |
844 |
|
|
845 |
Example: after the following, |
Example: after the following, |
846 |
|
|