Function: lock-file

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

Signature

(lock-file FILE)

Documentation

Check whether FILE was modified since it was visited, and lock it.

If user option create-lockfiles is nil, this does not create a lock file for FILE, but it still checks whether FILE was modified outside of the current Emacs session, and if so, asks the user whether to modify FILE.

Probably introduced at or before Emacs version 25.1.

Source Code

// Defined in /usr/src/emacs/src/filelock.c
{
#ifndef MSDOS
  CHECK_STRING (file);

  /* If the file name has special constructs in it,
     call the corresponding file name handler.  */
  Lisp_Object handler;
  handler = Ffind_file_name_handler (file, Qlock_file);
  if (!NILP (handler))
    return call2 (handler, Qlock_file, file);

  lock_file (file);
#endif	/* MSDOS */
  return Qnil;
}