Running the following code:

(global-set-key (kbd "M-s s") 'forward-char)

Then using the command M-s s outputs

M-s s is undefined.

I have to bind to override-global-map for it to work:

(define-key override-global-map (kbd "M-s s") 'forward-char)

Why? Emacs version 25.1.1.

  • 1
    GNU Emacs 25.1.50 on Ubuntu 16.04.3 LTS: (global-set-key (kbd "M-s s") 'forward-char) works for me. – Tobias Jan 27 '18 at 20:12
  • @Tobias I restarted with emacs -q, and it works fine. After booting up Emacs again, I realized that this binding works fine in the startup *messages* buffer, but no other buffers (prog-mode, fundamental-mode, org-mode, nothing). This is not a problem in emacs -q. – Dodgie Jan 27 '18 at 20:50
  • 2
    That means you have a configuration problem. Try to get more info via C-h k M-s s. If you don't have any further information the usual strategy is bisection of the configuration (initialization files). Deactivate half of your configuration and test whether the problem persists. The result of that test tells you which part of your configuration you should further bisect. – Tobias Jan 27 '18 at 20:57
  • I tried that before, and it simply reiterates that it is not defined. I'll have to binary search it. I'll update this question if I ever get around to finding out what the problem is. But still, I'm curious how it could even happen. If some higher priority keymap is shadowing the binding, it would simply call that command. Must be some hook that's run after the first time I switch from the initial buffer. – Dodgie Jan 27 '18 at 22:04
  • Try M-s ? this will offer you auto-complete options for this keymap. This will hint you as to who redefined this keymap (and tramped your binding). – wvxvw Jan 28 '18 at 10:36

Your Answer

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

Browse other questions tagged or ask your own question.