By default, M-s a prefix key bound to search-map, containing commands like occur (M-s o) and isearch-forward-word (M-s w).

I thought I'd change my search-map prefix key to ESC M-s in order to use M-s for save-buffer (I'm on a Mac and I use as my meta key).

I like the bind-key package, but I can't figure out how to bind a prefix key to a keymap with it. I naively tried:

(bind-keys ("M-s"     . save-buffer)
           ("ESC M-s" . search-map))

but that doesn't work because bind-keys expects an alist whose values are commands, but search-map is a keymap.

I've resorted to doing it without any of bind-key's helper functions:

(global-set-key (kbd "ESC M-s") search-map)

I see bind-key has the ability to bind keys within a particular map, and to define a new prefix map, but I don't see a way to bind to an existing map. Maybe there is no way to do this using bind-key macros, but I thought I'd ask in case anyone knows otherwise.

I'm not totally convinced I want to move the search-map onto a less convenient prefix key just to get saving bound to ⌘S, but I'd like to try it out.

1 Answer 1


Although bind-keys can't do this, bind-key can:

(bind-key "ESC M-s" search-map)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.