Homepage
Recent Changes
Search:
History of 2021-11-13 y-or-n-p but with RET meaning yes
2021-11-13
04:44 UTC
Revision 1
. . . .
mbork
–
Today, I had an extremely specific need. I wanted the Elisp function y-or-n-p (which asks the user a yes-or-no question, expecting a one-key answer of y or n), but I wanted to interpret RET (or “Enter”) as “yes”. It turns out that by default it means “exit”, which is because y-or-n-p-map has no binding for RET, and y-or-n-p falls back on query-replace-map (in a rather convoluted way). So, here is one way I could change it: