emacs-super-duper-yes-or-no

Replace the yes-or-no function with an even more demanding yes or no prompt, rather than with y-or-n.
Log | Files | Refs | LICENSE

commit 9cb390c90fec53e5855beba5db0fa60dda91a86c
parent dbb41199e54af4f03c53e6d2dc9c18ab19d72853
Author: Yuval Langer <yuvallangerontheroad@gmail.com>
Date:   Thu,  5 Oct 2023 17:22:32 +0300

Replace a few conds with simpler expressions.  Remove interactive directive.

Diffstat:
Msuper-duper-yes-or-no.el | 40++++++++--------------------------------
1 file changed, 8 insertions(+), 32 deletions(-)

diff --git a/super-duper-yes-or-no.el b/super-duper-yes-or-no.el @@ -99,9 +99,6 @@ intersperser)))))) (defun sd-yes-or-no-p (prompt) - "" - (interactive) - (let* ((wanted-yes-or-no (sd--make-random-yes-or-no-input-pair sd-number-of-words)) (wanted-yes (car wanted-yes-or-no)) @@ -132,15 +129,8 @@ "\" for yes, \"" wanted-no-string "\" for no) ")))) - (cond - ((equal user-input - wanted-yes-string) - (setq result - t)) - ((equal user-input - wanted-no-string) - (setq result - nil))))) + (equal user-input + wanted-yes-string))) (defun sd--toggle-char-case (our-char) (cond @@ -191,8 +181,6 @@ collect input-char))) (defun sd-yes-or-no-toggle-case-p (prompt) - (interactive) - (let* ((wanted-yes-prompt (sd--randomly-toggle-string-case sd-upper-case-phrase-for-yes @@ -242,13 +230,8 @@ "\n" wanted-no-prompt ":\n")))) - (cond - ((equal user-input - wanted-input-yes) - t) - ((equal user-input - wanted-input-no) - nil))))) + (equal user-input + wanted-input-yes)))) (defun sd--make-arithmetic-problem-number () (sd--randint sd-arithmetic-problem-minimum @@ -274,8 +257,6 @@ (sd--make-arithmetic-problem-arguments (cdr arithmetic-expression-template)))))) (defun sd--yes-or-no-arithmetic-problem-p (prompt) - (interactive) - (let* ((wanted-yes-prompt (sd--make-arithmetic-problem sd--arithmetic-problem-template)) @@ -316,17 +297,12 @@ (read-from-minibuffer (concat prompt "Please answer " - wanted-yes-prompt + (format "%S" wanted-yes-prompt) " for \"yes\" and " - wanted-no-prompt + (format "%S" wanted-no-prompt) " for \"no\": "))))) - (cond - ((= user-input - wanted-input-yes) - t) - ((= user-input - wanted-input-no) - nil))))) + (= user-input + wanted-input-yes)))) ;; Local Variables: ;; read-symbol-shorthands: (("sd-" . "super-duper-yes-or-no-"))