rflood89
rflood89

Reputation: 714

Cant bind to Meta key?

Hi I have been experiencing some strange problems recently when trying to bind a command to the Meta key. This has only started happening today and I'm really confused.

In my list of bindings I have definitions such as (define-key map (kbd "M-f") 'forward-char) and likewise with Ctrl and Hyper but for some reason when I try to bind with a combination of Meta it simply fails.

The following, (define-key map (kbd "C-M-f") 'forward-word) for instance displays an error message saying.

Warning (initialization): An error occurred while loading '/home/flood/.emacs.d/init.el': error: Key sequence C-M-f starts with non-prefix key To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the '--debug-init' option to view a complete error backtrace.

When starting with --debug-init it doesn't display anything helpful. Does anyone have any ideas this is really frustrating!

Upvotes: 2

Views: 639

Answers (1)

rflood89
rflood89

Reputation: 714

So after wasting a few hours of my day I have finally fixed the problem. It appears to be a bug with emacs but at the moment I'm not going to do further tests, maybe later.

I had previously included a command which uses the C-[ combination which has resulted in any command after it which includes a Meta, either C-M or H-M to be declared invalid. I had to move the command around until I found that the error would appear and disappear whether after or before respectively.

If anyone is working on the emacs project and wishes to look into this then try it out, If you can't reproduce a bug I may forward a sample which was problematic for me. The main reason for posting it to help anyone else in the future who may be experiencing the same frustration.

Upvotes: 2

Related Questions