Function: emacs-lock-mode

emacs-lock-mode is an autoloaded, interactive and byte-compiled function defined in emacs-lock.el.gz.

Signature

(emacs-lock-mode &optional ARG)

Documentation

Toggle Emacs Lock mode in the current buffer.

If called with a plain prefix argument, ask for the locking mode to be used.

Initially, if the user does not pass an explicit locking mode, it defaults to emacs-lock-default-locking-mode (which see); afterwards, the locking mode most recently set on the buffer is used instead.

When called from Elisp code, ARG can be any locking mode:

 exit -- Emacs cannot exit while the buffer is locked
 kill -- the buffer cannot be killed, but Emacs can exit as usual
 all -- the buffer is locked against both actions

Other values are interpreted as usual.

See also emacs-lock-unlockable-modes, which exempts buffers under some major modes from being locked under some circumstances.

Probably introduced at or before Emacs version 24.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lock.el.gz
;;;###autoload
(define-minor-mode emacs-lock-mode
  "Toggle Emacs Lock mode in the current buffer.
If called with a plain prefix argument, ask for the locking mode
to be used.

Initially, if the user does not pass an explicit locking mode, it
defaults to `emacs-lock-default-locking-mode' (which see);
afterwards, the locking mode most recently set on the buffer is
used instead.

When called from Elisp code, ARG can be any locking mode:

 exit   -- Emacs cannot exit while the buffer is locked
 kill   -- the buffer cannot be killed, but Emacs can exit as usual
 all    -- the buffer is locked against both actions

Other values are interpreted as usual.

See also `emacs-lock-unlockable-modes', which exempts buffers under
some major modes from being locked under some circumstances."
  :init-value nil
  :lighter (""
            (emacs-lock--try-unlocking " locked:" " Locked:")
            (:eval (symbol-name emacs-lock-mode)))
  :group 'emacs-lock
  :variable (emacs-lock-mode .
                             (lambda (mode)
                               (emacs-lock--set-mode mode arg current-prefix-arg)))
  (when emacs-lock-mode
    (setq emacs-lock--old-mode emacs-lock-mode)
    (setq emacs-lock--try-unlocking
          (and (if (eq emacs-lock-unlockable-modes t)
                   (emacs-lock-live-process-p (current-buffer))
                 (assq major-mode emacs-lock-unlockable-modes))
               t))))