History of 2021-07-26 Binding a command to every key bound to another command

2021-07-26
06:10 UTC Revision 1 . . . . mborkFor today, I have an extremely specific Emacs Lisp tip – this is definitely not something you would use every day, but when you need it, it’s there. Assume that you are writing a mode (call it cool-mode), which should support some general Emacs command (call it do-something) – only the workings of this mode are so specific that this command should be basically written from scratch instead of using Emacs’ own do-something. You could (of course) advise do-something, but it seems cleaner to define cool-do-something instead. How do you bind it to the same keys it is normally bound to in Emacs? For bonus points, the user might have its Emacs customized (with global-set-key, for example) to bind do-something to a key of their choice.