[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is alia
bug#28525: 26.0.60; dired-delete-file: Accept y/n if yes-or-no-p is aliased to y-or-n-p
Mon, 2 Oct 2017 14:40:20 +0900 (JST)
Alpine 2.20 (DEB 67 2015-01-07)
On Sun, 1 Oct 2017, Drew Adams wrote:
FWIW: I don't think that Emacs should test for
function aliases and change its behavior accordingly.
I don't think users should be encouraged to alias
`yes-or-no-p' to `y-or-n-p'. That's a bad idea
_in general_, IMO, even if it some users might
find it's appropriate for them.
I think that making Emacs code automatically
recognize such an alias just encourages such
(bad) practice on the part of users.
FWIW2: It can, however, be helpful to let users
override a design choice of `y-or-n-p' or
`yes-or-no-p' _for a given calling function_
(as opposed to globally). I've written library
Yes-No, to provide such a feature.
Thank you for the detailed answer.
Your library looks a good solution to add more control
where to allow aliasing 'yes-or-no-p to 'y-or-n-p.
Here, what i am trying to propose is different: extend the
'yes or no' functions (or add two new functions),
so that they accept more than 2 answers.
This is inpired in the way `query-replace' works:
M-% a RET o RET
This prompts to replace 'a' with 'o'. In principle this
looks like a 'yes or no' question; actually we can
provide additional answers: all possibilities are listed
if the user inputs 'h'. For example, '!' performs all replacements
without further questions.
We find something similar in dired-delete-file: in addition
to 'yes', 'no', we can answer to delete all the dirs with
no more questions.
A function like 'yes-or-no-p' accepting more than 2 answers
might be used to handle the examples above, and future cases.