Fix infinite loop on invalid answer to straight prompts
This commit is contained in:
parent
2a01a9dcdf
commit
6599388f00
1 changed files with 14 additions and 9 deletions
|
@ -161,15 +161,20 @@ missing) and shouldn't be deleted.")
|
||||||
(push func options)
|
(push func options)
|
||||||
(print! "%2s) %s" (length options) desc)))))
|
(print! "%2s) %s" (length options) desc)))))
|
||||||
(terpri)
|
(terpri)
|
||||||
(let ((answer
|
(let ((options (nreverse options))
|
||||||
(read-number (format! "How to proceed? (%s) "
|
answer fn)
|
||||||
(mapconcat #'number-to-string
|
(while
|
||||||
(number-sequence 1 (length options))
|
(not
|
||||||
", "))))
|
(setq
|
||||||
fn)
|
fn (ignore-errors
|
||||||
(setq options (nreverse options))
|
(nth (1- (setq answer
|
||||||
(while (not (setq fn (nth (1- answer) options)))
|
(read-number
|
||||||
(print! "%s is not a valid answer, try again." answer))
|
(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))))))
|
(funcall fn))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue