Function: lock-file-mode

lock-file-mode is an interactive and byte-compiled function defined in files.el.gz.

Signature

(lock-file-mode &optional ARG)

Documentation

Toggle file locking in the current buffer (Lock File mode).

This is a minor mode. If called interactively, toggle the Lock-File mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate the variable lock-file-mode(var)/lock-file-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

View in manual

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(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)))