首页 文章

键入C-x时Emacs迷你缓冲消息

提问于
浏览
5

好 . 当我键入密钥系列的一些第一个密钥时,emacs会在一段时间后将这些密钥写入迷你缓冲区 . 像这样:键入 C-x 4 将使迷你缓冲区中的 C-x 4- 可见 .

问题是:这可以修改吗?我正在考虑将类似帮助的一部分(在键入某些键时由 C-h 生成)与此字符串组合在一起 . 等待此消息的间隔也可以缩短吗?它是子程序吗?

编辑,新问题

当我退出带有 C-x C-c 的emacs并且有修改过的缓冲区时,会有一条消息,询问我是否要保存它们 . How can I know that this message is here? 我试图查看 (minibuffer-prompt) (minibuffer-contents) (buffer-substring (point-min) (point-max)) ,选择 (select-window (minibuffer-window)) . 什么都没有给我结果 .

3 回答

  • 1

    您可以通过将suggest-key-bindings设置为更大/更小的数字来控制此帮助消息的时间 .

    (setq suggest-key-bindings 5) ; wait 5 seconds
    

    没有简单的方法来自定义行为,您必须编辑 execute-extended-command 的C代码,或使用替代它也提供帮助 . 替换的一种可能性是anything-complete库,它替换了 execute-extended-command (注意:我还没有尝试过) . 它 Build 在anything包之上,这是一种与标准Emacs不同的体验 .

  • 7

    是的,用户选项 echo-keystrokes 控制在迷你缓冲区中显示前缀键之前经过的时间 . 来自(emacs) Echo Area Customization

    User Option: echo-keystrokes
         This variable determines how much time should elapse before command
         characters echo.  Its value must be an integer or floating point
         number, which specifies the number of seconds to wait before
         echoing.  If the user types a prefix key (such as `C-x') and then
         delays this many seconds before continuing, the prefix key is
         echoed in the echo area.  (Once echoing begins in a key sequence,
         all subsequent characters in the same key sequence are echoed
         immediately.)
    
         If the value is zero, then command input is not echoed.
    
  • 0

    I wrote working version of what I wanted to implement.

    要使用 (require 'keylist) ,请将一个或两个最后一行复制到.emacs并取消注释 .

    正如您可以看到这段代码,我使用了这个

    (not cursor-in-echo-area)
    (not (minibufferp))
    (not (= 13 (aref (this-command-keys-vector) 0)))
    

    找出,如果我的迷你缓冲区或回声区域正在使用中 . 它们之间的区别在于迷你缓冲区用于读取,而回波区域用于发送消息 . 当您键入 C-x C-c 时,光标位于回显区域,并且 cursor-in-echo-area 的值已更改 .

    最后一个字符串 (= 13 (aref (this-command-keys-vector) 0)) 是最搞笑的 . 它用于捕捉像 query-replace 这样的东西 . 在进行替换时, (this-command-keys-vector) 显示 RET 是第一个按下的键,然后是你的选择键(y,n) . 至于我没有以 RET 开头的键序列,我对此感到满意 .

相关问题