emacs error: Key sequence M-x g starts with non-prefix key M-x

后端 未结 1 1912
被撕碎了的回忆
被撕碎了的回忆 2021-02-07 12:32

I have the following code in .emacs: (global-set-key (kbd \"M-x g\") \'gnus) to start Gnus with the keybinding M-x g. I obtain: erro

1条回答
  •  暖寄归人
    2021-02-07 13:03

    The key M-x is already bound to the command execute-extended-command, which then asks you to provide the name of a command to execute (in you case: gnus).

    Since R is a command only one-character long, it looks like M-x R is a key sequence, but it's not: it's M-x followed by entering R in the minibuffer and you have to hit RET to validate your input.

    In short:

    • you can not set key sequences beginning with M-x since this key is already bound to a command and is thus not a prefix (unlike C-c, which does nothing but wait for you to type another key, but should be reserved for bindings specific to the current modes).
    • the standard way to do things would be to continue starting gnus using M-x gnus or to rebind it to an entirely different key if you need to be very quick (you could for example use one of the F1-F12 keys)
    • if you really want to have a M-x + letter binding, you can define a one-letter alias to the command gnus, like this:
        (defalias 'g 'gnus)
    

    0 讨论(0)
提交回复
热议问题