【问题标题】:What is the keybind in help-mode to go into link?帮助模式下进入链接的键绑定是什么?
【发布时间】:2016-01-05 11:37:22
【问题描述】:

帮助模式下总是有链接,这些链接应该由<return> 按钮输入。由于我将<return> 按钮重新映射到indent-and-new-line,因此我无法再输入链接。我想为输入按钮找到正确的按键映射。

Help mode defined in `help-mode.el' (`help-mode'):
Major mode for viewing help text and navigating references in it.
Entry to this mode runs the normal hook `help-mode-hook'.
Commands:
key             binding
---             -------

C-c             Prefix Command
TAB             forward-button
  (that binding is currently shadowed by another mode)
RET             help-follow
  (that binding is currently shadowed by another mode)
ESC             Prefix Command
SPC             scroll-up-command

我从描述模式中获得了帮助。我尝试了help-follow,但它不起作用。正确的键绑定应该是什么?

【问题讨论】:

    标签: emacs keymaps minor-mode


    【解决方案1】:

    默认情况下,REThelp-mode 中的链接上运行push-button。如果您喜欢使用啮齿动物,您还应该能够用您的主鼠标按钮单击链接。此功能未绑定到任何其他开箱即用的键。

    我不确定您是如何重新绑定RET,但更有选择性地执行此操作可能更有意义。 indent-and-new-line 在大多数模式下可能都有意义,但正如您所发现的,在某些情况下您可能需要默认行为。

    也许你可以通过prog-mode-hook 来做到这一点,所以它只会影响编程模式?

    或者,您可以将其他一些键绑定到 push-button 中的 help-mode

    顺便说一句,这里有一个有用的技术可以让你自己发现这个键绑定:

    1. 使用 -Q 标志运行 Emacs 以禁止加载您的 init 文件和系统 init 文件。
    2. 激活使用help-mode 的缓冲区,例如使用C-h f message RET 查看message 函数的文档,然后使用C-x o 切换到帮助窗口。
    3. C-h k RET查看RET绑定了什么函数。

    【讨论】:

    • 我发现这个键绑定完全是C-h k。我知道我总是可以使用鼠标点击进入链接,但它太慢了。确实,我尝试过反弹help-follow,但没有奏效。我尝试将光标放在链接和M-x help-follow 上,这也不起作用。
    • 但是我没有检查函数本身。也许它需要一个区域作为参数。
    • @tom,显然我弄错了。 RET 在链接上时绑定到 push-button,在链接上时绑定到 help-follow。对困惑感到抱歉。我已经更新了我的答案。
    • @tom,我通过将点放在链接上找到它(使用tab,绑定到forward-button)然后再次执行C-h k RET。在我的系统上,这两个函数都在/usr/share/emacs/25.1.50/lisp/button.elc 中定义(.el 文件不存在),可以使用例如M-x find-function RET push-button RET.
    • 如果感兴趣的话,我自己对RET 的方法是在prog-mode-hook 中评估(local-set-key (kbd "RET") (key-binding (kbd "M-j")))(加上一些其他选定的钩子,用于不是从prog-mode 派生的模式)。 M-jindent-new-comment-line 的标准键,但一些主要模式具有该功能的自定义命令,所以这样我总能得到合适的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-17
    • 1970-01-01
    • 1970-01-01
    • 2016-07-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多