mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
Use 'read-char-choice' in 'ask-user-about-lock' (bug#79664)
* lisp/userlock.el (ask-user-about-lock): Use 'read-char-choice' instead of 'read-char'. * lisp/subr.el (read-char-choice-with-read-key): Add fallback cond-branch to show a message with required keys.
This commit is contained in:
parent
d9ddf0d075
commit
89f0853f1e
2 changed files with 18 additions and 9 deletions
11
lisp/subr.el
11
lisp/subr.el
|
|
@ -3745,7 +3745,16 @@ causes it to evaluate `help-form' and display the result."
|
|||
((and (null esc-flag) (eq char ?\e))
|
||||
(setq esc-flag t))
|
||||
((memq char '(?\C-g ?\e))
|
||||
(keyboard-quit))))))))
|
||||
(keyboard-quit))))
|
||||
(t
|
||||
(beep)
|
||||
(message "Please type %s"
|
||||
(substitute-command-keys
|
||||
(mapconcat (lambda (c)
|
||||
(format "\\`%s'"
|
||||
(single-key-description c)))
|
||||
chars ", ")))
|
||||
(sit-for 3))))))
|
||||
;; Display the question with the answer. But without cursor-in-echo-area.
|
||||
(message "%s%s" prompt (char-to-string char))
|
||||
char))
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ You can redefine this function to choose among those three alternatives
|
|||
in any way you like."
|
||||
(discard-input)
|
||||
(save-window-excursion
|
||||
(let (answer short-opponent short-file)
|
||||
(let ((choices `(?s ?q ?p ?S ?Q ?P ?\C-g ?? ,help-char))
|
||||
prompt short-opponent short-file answer)
|
||||
(setq short-file
|
||||
(if (> (length file) 22)
|
||||
(concat "..." (substring file (- (length file) 22)))
|
||||
|
|
@ -63,16 +64,15 @@ in any way you like."
|
|||
(concat (substring opponent 0 13) "..."
|
||||
(match-string 0 opponent)))
|
||||
opponent))
|
||||
(setq prompt (format-message
|
||||
(substitute-command-keys
|
||||
"%s locked by %s: (\\`s', \\`q', \\`p', \\`?')? ")
|
||||
short-file short-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)
|
||||
(let ((tem (let ((inhibit-quit t)
|
||||
(cursor-in-echo-area t))
|
||||
(prog1 (downcase (read-char))
|
||||
(setq quit-flag nil)))))
|
||||
(let ((tem (prog1 (downcase (read-char-choice prompt choices t))
|
||||
(setq quit-flag nil))))
|
||||
(if (= tem help-char)
|
||||
(ask-user-about-lock-help)
|
||||
(setq answer (assoc tem '((?s . t)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue