I've switched from emacs to spacemacs, but my muscle memory still uses the standard emacs keybindings -- despite attempts at avoiding key chords. As an example, to save a file, I continue to use Ctrl x s instead of SPC f s.

What I'd like is a function that would provide a modeline prompt for keystrokes that I'm trying to avoid.

"Ctrl x s deprecated. Use instead: SPC f s"

Update: I used the function that muffinmad supplied with a minor tweak. For some tasks my attention isn't focused on the modeline, so an additional audio alert helps:

    (play-sound-file "oops.wav")

1 Answer 1



(global-set-key (kbd "C-x C-s") (lambda ()
                                  (message "Ctrl x s deprecated. Use instead: SPC f s")))

save-buffer may be called while displaying deprecation message but doing so will reduce effectiveness. Just displaying deprecation message will force you to use new key binding.

  • Can you elaborate? Shouldn't this function try to execute whatever it was supposed to be bound to while displaying the deprecation warning?
    – user12563
    May 22, 2019 at 7:10
  • @DoMiNeLa10 added note about effectiveness :)
    – muffinmad
    May 22, 2019 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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