Function: tpu-y-or-n-p
tpu-y-or-n-p is a byte-compiled function defined in tpu-edt.el.gz.
Signature
(tpu-y-or-n-p PROMPT &optional NOT-YES)
Documentation
Prompt for a y or n answer with positive default.
Optional second argument NOT-YES changes default to negative.
Like Emacs y-or-n-p, but also accepts space as y and DEL as n.
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/tpu-edt.el.gz
(defun tpu-y-or-n-p (prompt &optional not-yes)
"Prompt for a y or n answer with positive default.
Optional second argument NOT-YES changes default to negative.
Like Emacs `y-or-n-p', but also accepts space as y and DEL as n."
(message "%s[%s]" prompt (if not-yes "n" "y"))
(let ((doit t))
(while doit
(setq doit nil)
(let ((ans (read-char)))
(cond ((or (= ans ?y) (= ans ?Y) (= ans ?\ ))
(setq tpu-last-answer t))
((or (= ans ?n) (= ans ?N) (= ans ?\C-?))
(setq tpu-last-answer nil))
((= ans ?\r) (setq tpu-last-answer (not not-yes)))
(t
(setq doit t) (beep)
(message "Please answer y or n. %s[%s]"
prompt (if not-yes "n" "y")))))))
tpu-last-answer)