Emacs:如何将"Mx"提示更改为其他内容?

Mir*_*lov 3 emacs

execute-extended-command一定要用alt + a.因此,当我使用迷你缓冲区时,按下它时,只读提示"Mx"对我来说无关紧要.我想将其更改为"执行命令:"之类的其他内容.我怎样才能做到这一点?

phi*_*ils 6

此提示是硬编码的.您需要重新定义read-extended-command或建议completing-read(但这似乎是一种相当脆弱的方法).

看到 M-x find-function RET read-extended-command RET

代码中有评论指的是这个问题:

;; This isn't strictly correct if `execute-extended-command'
;; is bound to anything else (e.g. [menu]).
;; It could use (key-description (this-single-command-keys)),
;; but actually a prompt other than "M-x" would be confusing,
;; because "M-x" is a well-known prompt to read a command
;; and it serves as a shorthand for "Extended command: ".
Run Code Online (Sandbox Code Playgroud)

老实说,由于缺乏一个干净的解决方案,我不打算尝试这样做.


san*_*inc 5

检查smex,这是对内置的改进execute-extended-command; 它允许您通过变量自定义提示smex-prompt-string.

或者,如果你已经安装了Emacs源代码,你可以直接跳转到实现:只是 M-x find-function RET execute-extended-command RET