I want two keymaps to be "roughly" the same in Emacs. In particular, I want the keymap for the "super" key to default to doing what the "meta" key does.
So, I would like to write some code that copies the contents of the meta-keymap to the super-keymap. Something like the following:
(defun copy-one-key (from-keymap to-keymap key-sequence)
;; don't bind keys already bound
(unless (get-key-binding to-keymap key-sequence)
(set-key-binding to-key-map key-sequence
(get-key-binding from-keymap key-sequence)
) ; set
) ; when
) ; defun
(defun copy-keymap (from-keymap to-keymap)
(mapcar from-keymap
(lambda key-sequence
(copy-one-key from-keymap to-keymap key-sequence)
) ; lambda
) ; mapcar
) ; defun
(copy-keymap meta-keymap super-keymap)
In a related issue. I don't know if there actually are named keymaps for the meta-keymap and super-keymap of if I somehow need to parse them out of the global-keymap looking for "M-" and changing it to "s-".
I forgot to add that I essentially want to add an advice to every function I copy.