I read somewhere that emacs v29.1 has changed the way that you can define key bindings...

ie previously you would write:-

(global-set-key (kbd "<f2>") 'save-buffer)

now you can write:-

(keymap-global-set "C-c y" 'clipboard-yank) 

Is there a simple way to convert one to the other? Possibly a sed script?

  • 1
    Does this answer your question? Moving from legacy function global-set-key to keymap-global-set
    – Drew
    Oct 4, 2023 at 14:35
  • If you mean a non-interactive way then the question has nothing really to do with either of the functions you cite. It's instead about transforming Lisp code across a set of files. And that too is likely a duplicate question.
    – Drew
    Oct 4, 2023 at 14:37
  • I looked at the post mentioned, but the solution seemed too complicated. As an alternative I've come up with my own sed script. ~sed -e 's/global-set-key (kbd/keymap-global-set/' -e 's/)//'~
    – balanga
    Oct 4, 2023 at 17:15

1 Answer 1


Don’t bother. global-set-key isn’t going away, and keymap-global-set doesn’t do anything new. Changing your config in this way won’t actually accomplish anything.

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.