comparison lispref/files.texi @ 59877:36a927615e6d

(File Locks): Not supported on MS systems. (Testing Accessibility): Clarify.
author Richard M. Stallman <rms@gnu.org>
date Thu, 03 Feb 2005 07:01:04 +0000
parents 54f19dd158e9
children 78a2cd972ba1 72cf6261961e
comparison
equal deleted inserted replaced
59876:59d6cfcd4c9a 59877:36a927615e6d
644 644
645 @node File Locks 645 @node File Locks
646 @section File Locks 646 @section File Locks
647 @cindex file locks 647 @cindex file locks
648 648
649 When two users edit the same file at the same time, they are likely to 649 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 650 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. 651 from arising by recording a @dfn{file lock} when a file is being
652 modified. (File locks are not implemented on Microsoft systems.)
652 Emacs can then detect the first attempt to modify a buffer visiting a 653 Emacs can then detect the first attempt to modify a buffer visiting a
653 file that is locked by another Emacs job, and ask the user what to do. 654 file that is locked by another Emacs job, and ask the user what to do.
654 The file lock is really a file, a symbolic link with a special name, 655 The file lock is really a file, a symbolic link with a special name,
655 stored in the same directory as the file you are editing. 656 stored in the same directory as the file you are editing.
656 657
678 679
679 @defun lock-buffer &optional filename 680 @defun lock-buffer &optional filename
680 This function locks the file @var{filename}, if the current buffer is 681 This function locks the file @var{filename}, if the current buffer is
681 modified. The argument @var{filename} defaults to the current buffer's 682 modified. The argument @var{filename} defaults to the current buffer's
682 visited file. Nothing is done if the current buffer is not visiting a 683 visited file. Nothing is done if the current buffer is not visiting a
683 file, or is not modified. 684 file, or is not modified, or if the system does not support locking.
684 @end defun 685 @end defun
685 686
686 @defun unlock-buffer 687 @defun unlock-buffer
687 This function unlocks the file being visited in the current buffer, 688 This function unlocks the file being visited in the current buffer,
688 if the buffer is modified. If the buffer is not modified, then 689 if the buffer is modified. If the buffer is not modified, then
689 the file should not be locked, so this function does nothing. It also 690 the file should not be locked, so this function does nothing. It also
690 does nothing if the current buffer is not visiting a file. 691 does nothing if the current buffer is not visiting a file, or if the
692 system does not support locking.
691 @end defun 693 @end defun
692 694
693 File locking is not supported on some systems. On systems that do not 695 File locking is not supported on some systems. On systems that do not
694 support it, the functions @code{lock-buffer}, @code{unlock-buffer} and 696 support it, the functions @code{lock-buffer}, @code{unlock-buffer} and
695 @code{file-locked-p} do nothing and return @code{nil}. 697 @code{file-locked-p} do nothing and return @code{nil}.
832 @end defun 834 @end defun
833 835
834 @c Emacs 19 feature 836 @c Emacs 19 feature
835 @defun file-accessible-directory-p dirname 837 @defun file-accessible-directory-p dirname
836 This function returns @code{t} if you have permission to open existing 838 This function returns @code{t} if you have permission to open existing
837 files in the directory whose name as a file is @var{dirname}; otherwise 839 files in the directory whose name as a file is @var{dirname};
838 (or if there is no such directory), it returns @code{nil}. The value 840 otherwise (or if there is no such directory), it returns @code{nil}.
839 of @var{dirname} may be either a directory name or the file name of a 841 The value of @var{dirname} may be either a directory name (such as
840 file which is a directory. 842 @file{/foo/}) or the file name of a file which is a directory
843 (such as @file{/foo}, without the final slash).
841 844
842 Example: after the following, 845 Example: after the following,
843 846
844 @example 847 @example
845 (file-accessible-directory-p "/foo") 848 (file-accessible-directory-p "/foo")