aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Baugh2023-11-10 07:20:09 -0500
committerEli Zaretskii2023-11-15 15:35:26 +0200
commitf554872997a2f8e4e8ad4342a4b0955bfc7ad3f4 (patch)
treef897684f2124732ea66e21a17f09c32d92d93591
parent8b458aea86ccbba255cbc5e97d6426df1e8bc6d9 (diff)
downloademacs-f554872997a2f8e4e8ad4342a4b0955bfc7ad3f4.tar.gz
emacs-f554872997a2f8e4e8ad4342a4b0955bfc7ad3f4.zip
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)
-rw-r--r--lisp/userlock.el3
1 files changed, 2 insertions, 1 deletions
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."
64 (match-string 0 opponent))) 64 (match-string 0 opponent)))
65 opponent)) 65 opponent))
66 (while (null answer) 66 (while (null answer)
67 (when noninteractive
68 (signal 'file-locked (list file opponent "Cannot resolve lock conflict in batch mode")))
67 (message (substitute-command-keys 69 (message (substitute-command-keys
68 "%s locked by %s: (\\`s', \\`q', \\`p', \\`?')? ") 70 "%s locked by %s: (\\`s', \\`q', \\`p', \\`?')? ")
69 short-file short-opponent) 71 short-file short-opponent)
70 (if noninteractive (error "Cannot resolve lock conflict in batch mode"))
71 (let ((tem (let ((inhibit-quit t) 72 (let ((tem (let ((inhibit-quit t)
72 (cursor-in-echo-area t)) 73 (cursor-in-echo-area t))
73 (prog1 (downcase (read-char)) 74 (prog1 (downcase (read-char))