Perhaps instead of adding recommendations about this, we could have a
feature where define-key invoked as part as 'load' or 'require' would
check, once, if the key being rebound already has a binding,
and ask
the user what she would like to do about, with 3 possible answers
being "rebind", "don't rebind", and "error out of 'load'"?
Would that halt emacs startup with that prompt? If so, I believe that would cause an annoyance for a lot of users who might have already shadowed bindings.
What if define-key is instead made to throw a message or a warning?
In addition, current signature of define-key is:
(define-key KEYMAP KEY DEF)
If it is made into
(define-key KEYMAP KEY DEF &optional ALLOW-OVERRIDE)
- By default, the overriding will happen as now, but the above mentioned warning will also be put out in *Messages*.
- If ALLOW-OVERRIDE is 'prevent, the overriding will be blocked silently.
- If ALLOW-OVERRIDE is any other non-nil value, overriding will happen and that warning is not thrown.