From f554872997a2f8e4e8ad4342a4b0955bfc7ad3f4 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Fri, 10 Nov 2023 07:20:09 -0500 Subject: [PATCH] Signal file-locked on lock conflict with noninteractive=t Previously we would signal a generic error on lock conflict when noninteractive=t. That meant that non-interactively handling a lock conflict would require catching all errors and checking the string in DATA. Now we just signal file-locked instead, which matches the interactive behavior when the user says "q" at the prompt. Also, when noninteractive, we signal before we write the prompt about the lock conflict. That prompt usually gets in the way of noninteractively handling and suppress lock conflict errors. The signal data contains all the necessary information, we don't need to write a separate message for noninteractive. * lisp/userlock.el (ask-user-about-lock): Signal file-locked on noninteractive lock conflict. (bug#66993) --- lisp/userlock.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/userlock.el b/lisp/userlock.el index 4623608f1db..91d5b7308dd 100644 --- a/lisp/userlock.el +++ b/lisp/userlock.el @@ -64,10 +64,11 @@ in any way you like." (match-string 0 opponent))) opponent)) (while (null answer) + (when noninteractive + (signal 'file-locked (list file opponent "Cannot resolve lock conflict in batch mode"))) (message (substitute-command-keys "%s locked by %s: (\\`s', \\`q', \\`p', \\`?')? ") short-file short-opponent) - (if noninteractive (error "Cannot resolve lock conflict in batch mode")) (let ((tem (let ((inhibit-quit t) (cursor-in-echo-area t)) (prog1 (downcase (read-char)) -- 2.39.2