mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Fix infinite loop on invalid answer to straight prompts
This commit is contained in:
@ -161,15 +161,20 @@ missing) and shouldn't be deleted.")
|
||||
(push func options)
|
||||
(print! "%2s) %s" (length options) desc)))))
|
||||
(terpri)
|
||||
(let ((answer
|
||||
(read-number (format! "How to proceed? (%s) "
|
||||
(mapconcat #'number-to-string
|
||||
(number-sequence 1 (length options))
|
||||
", "))))
|
||||
fn)
|
||||
(setq options (nreverse options))
|
||||
(while (not (setq fn (nth (1- answer) options)))
|
||||
(print! "%s is not a valid answer, try again." answer))
|
||||
(let ((options (nreverse options))
|
||||
answer fn)
|
||||
(while
|
||||
(not
|
||||
(setq
|
||||
fn (ignore-errors
|
||||
(nth (1- (setq answer
|
||||
(read-number
|
||||
(format! "How to proceed? (%s) "
|
||||
(mapconcat #'number-to-string
|
||||
(number-sequence 1 (length options))
|
||||
", ")))))
|
||||
options))))
|
||||
(print! (warn "%s is not a valid answer, try again.") answer))
|
||||
(funcall fn))))))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user