emacs错误:键序列M-x g以非前缀键M-x开头 [英] emacs error: Key sequence M-x g starts with non-prefix key M-x

查看:100
本文介绍了emacs错误:键序列M-x g以非前缀键M-x开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 .emacs 中具有以下代码:(global-set-key(kbd Mx g)'gnus)以键绑定 Mx g 启动Gnus。我得到:错误:键序列M-x g以非前缀键M-x 开头。如何定义以 M-x 开头的键绑定?这是一件不好的事情,应该避免吗?我觉得它更直观,因为长版是 M-x gnus 。例如,将其定义为 Cc g 没问题,但是您可以使用 Cc g 和例如R来启动Gnus。通过 Mx R 并不是很直观(与通过 Mx + 1个字母

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: error: Key sequence M-x g starts with non-prefix key M-x. How can I define keybindings starting with M-x? Is this a bad thing to do and should be avoided? I find it more intuitive since the "long version" is M-x gnus. Defining it as C-c g for example is no problem but then you start Gnus with C-c g and, for example, R via M-x R which is not very intuitive (in contrast to starting both via M-x + 1 letter

推荐答案

Mx 已绑定到命令 execute-extended-command ,然后要求您提供要执行的命令的名称(在您的情况下为 gnus )。

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).

由于 R 是一个只有一个字符长的命令,因此看起来 Mx R 是一个键序列,但不是: Mx ,然后在迷你缓冲区中输入 R ,您必须按 RET 来验证输入。

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.

简而言之:


  • 您不能设置以 Mx开头的键序列,因为此键已经绑定到命令,因此不是前缀(不同于 Cc ,后者什么也不做,只等着您t o输入另一个键,但应保留给当前模式专用的绑定。)

  • 执行操作的标准方法是继续使用 Mx gnus 或将其重新绑定到完全不同的密钥(如果您需要非常快的话(例如,可以使用 F1 - F12 密钥之一)

  • 如果您确实希望具有 Mx +字母绑定,则可以为命令 gnus 定义一个字母的别名,例如:

  • 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)

这篇关于emacs错误:键序列M-x g以非前缀键M-x开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆