From c491a7533198ba875f8cc7dc26322744964b6000 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Fri, 5 Apr 2024 12:34:13 +0200 Subject: [PATCH] Actually do nothing when create-lockfiles is nil * src/filelock.c(lock-file, lock-buffer): Wrap the logic of the code in a check for create-lockfiles. --- src/filelock.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/filelock.c b/src/filelock.c index 8c27b226900..aad4f5abab1 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -642,18 +642,22 @@ DEFUN ("lock-file", Flock_file, Slock_file, 1, 1, 0, If the option `create-lockfiles' is nil, this does nothing. */) (Lisp_Object file) { + if (create_lockfiles) + { #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); + 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); + lock_file (file); #endif /* MSDOS */ + } return Qnil; } @@ -691,13 +695,16 @@ DEFUN ("lock-buffer", Flock_buffer, Slock_buffer, If the option `create-lockfiles' is nil, this does nothing. */) (Lisp_Object file) { - if (NILP (file)) - file = BVAR (current_buffer, file_truename); - else - CHECK_STRING (file); - if (SAVE_MODIFF < MODIFF - && !NILP (file)) - Flock_file (file); + if (create_lockfiles) + { + if (NILP (file)) + file = BVAR (current_buffer, file_truename); + else + CHECK_STRING (file); + if (SAVE_MODIFF < MODIFF + && !NILP (file)) + Flock_file (file); + } return Qnil; } -- 2.40.1