Function: lock-buffer

lock-buffer is a function defined in filelock.c.

Signature

(lock-buffer &optional FILE)

Documentation

Lock FILE, if current buffer is modified.

FILE defaults to current buffer's visited file, or else nothing is done if current buffer isn't visiting a file.

If the option create-lockfiles is nil, this does nothing.

Other relevant functions are documented in the buffer group.

View in manual

Shortdoc

;; buffer
(lock-buffer "/tmp/foo")

Source Code

// Defined in /usr/src/emacs/src/filelock.c
{
  if (NILP (file))
    file = BVAR (current_buffer, file_truename);
  else
    CHECK_STRING (file);
  if (SAVE_MODIFF < MODIFF
      && !NILP (file))
    Flock_file (file);
  return Qnil;
}