Commit 553ad9c9 authored by Michael Albinus's avatar Michael Albinus
Browse files

Add lock-file-mode

* doc/emacs/files.texi (Interlocking):
* doc/lispref/files.texi (File Locks):
* etc/NEWS: Add lock-file-mode.

* lisp/files.el (lock-file-name-transforms)
(remote-file-name-inhibit-locks): Move down.
(lock-file-mode): New minor mode.
parent 45cdc899
Pipeline #11441 failed with stages
in 1 minute
......@@ -849,6 +849,10 @@ diff-buffer-with-file} command. @xref{Comparing Files}.
You can prevent the creation of remote lock files by setting the
variable @code{remote-file-name-inhibit-locks} to @code{t}.
@cindex lock-file-mode
The minor mode @code{lock-file-mode}, called interactively, toggles
the local value of @code{create-lockfiles} in the current buffer.
@node File Shadowing
@subsection Shadowing Files
@cindex shadow files
......
......@@ -826,6 +826,11 @@ You can prevent the creation of remote lock files by setting the
variable @code{remote-file-name-inhibit-locks} to @code{t}.
@end defopt
@deffn Command lock-file-mode
This command, called interactively, toggles the local value of
@code{create-lockfiles} in the current buffer.
@end deffn
@node Information about Files
@section Information about Files
@cindex file, information about
......
......@@ -2191,6 +2191,22 @@ Shift while typing 'C-a', i.e. 'C-S-a', will now highlight the text.
If the 'EMACS_TEST_VERBOSE' environment variable is set, failure
summaries will include the failing condition.
** File Locks
+++
*** New user option 'lock-file-name-transforms'.
This option allows controlling where lock files are written. It uses
the same syntax as 'auto-save-file-name-transforms'.
+++
*** New user option 'remote-file-name-inhibit-locks'.
When non-nil, this option suppresses lock files for remote files.
+++
*** New minor mode 'lock-file-mode'.
This command, called interactively, toggles the local value of
'create-lockfiles' in the current buffer.
** Miscellaneous
---
......@@ -2209,15 +2225,6 @@ will now restore the original order.
This is like 'insert-buffer-substring', but works in the opposite
direction.
+++
*** New user option 'lock-file-name-transforms'.
This option allows controlling where lock files are written. It uses
the same syntax as 'auto-save-file-name-transforms'.
+++
*** New user option 'remote-file-name-inhibit-locks'.
When non-nil, this option suppresses lock files for remote files.
+++
*** New user option 'kill-transform-function'.
This can be used to transform (and suppress) strings from entering the
......
......@@ -412,26 +412,6 @@ ignored."
:initialize 'custom-initialize-delay
:version "21.1")
(defcustom lock-file-name-transforms nil
"Transforms to apply to buffer file name before making a lock file name.
This has the same syntax as
`auto-save-file-name-transforms' (which see), but instead of
applying to auto-save file names, it's applied to lock file names.
By default, a lock file is put into the same directory as the
file it's locking, and it has the same name, but with \".#\" prepended."
:group 'files
:type '(repeat (list (regexp :tag "Regexp")
(string :tag "Replacement")
(boolean :tag "Uniquify")))
:version "28.1")
(defcustom remote-file-name-inhibit-locks nil
"Whether to use file locks for remote files."
:group 'files
:version "28.1"
:type 'boolean)
(defvar auto-save--timer nil "Timer for `auto-save-visited-mode'.")
(defcustom auto-save-visited-interval 5
......@@ -485,6 +465,32 @@ If `silently', don't ask the user before saving."
:type '(choice (const t) (const nil) (const silently))
:group 'abbrev)
(defcustom lock-file-name-transforms nil
"Transforms to apply to buffer file name before making a lock file name.
This has the same syntax as
`auto-save-file-name-transforms' (which see), but instead of
applying to auto-save file names, it's applied to lock file names.
By default, a lock file is put into the same directory as the
file it's locking, and it has the same name, but with \".#\" prepended."
:group 'files
:type '(repeat (list (regexp :tag "Regexp")
(string :tag "Replacement")
(boolean :tag "Uniquify")))
:initialize 'custom-initialize-delay
:version "28.1")
(defcustom remote-file-name-inhibit-locks nil
"Whether to use file locks for remote files."
:group 'files
:version "28.1"
:type 'boolean)
(define-minor-mode lock-file-mode
"Toggle file locking in the current buffer (Lock File mode)."
:version "28.1"
(setq-local create-lockfiles (and lock-file-mode t)))
(defcustom find-file-run-dired t
"Non-nil means allow `find-file' to visit directories.
To visit the directory, `find-file' runs `find-directory-functions'."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment