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)
This commit is contained in:
Spencer Baugh 2023-11-10 07:20:09 -05:00 committed by Eli Zaretskii
parent 8b458aea86
commit f554872997

View file

@ -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))