如何查找帮助模式交叉引用指向的路径(无需访问它)



一些 Emacs *Help*缓冲区包含指向文件系统路径的活动交叉引用。 可以通过以通常的方式遵循外部参照来访问关联的文件,但我想知道如何确定外部参照指向的路径而不访问关联的文件(即遵循交叉引用)。

我该怎么做?

重要提示:我想在文本模式下使用 Emacs 时执行此操作。 (IOW,没有鼠标,没有菜单等)

PS1:我突然想到,获取所需信息的一种简单方法是查看*Help*缓冲区底层的源代码。 (我的意思是标识交叉引用项并保留其目标的标记。 我也找不到如何做到这一点。

PS2:在文档中的某个地方,我发现运行M-x visible-mode可能会显示我想要的信息,但是当我尝试它时,我在任何地方都看不到其他信息。 同上,摆弄变量Info-hide-note-references.

当指向相应的按钮时:

(cadr (button-get (button-at (point)) 'help-args))

您可以使用它来收集所有按钮:

(defun ali--help-collect-references ()
  "Collect the positions of visible links in the current `help-mode' buffer."
  (let ((skip (text-property-any (point-min) (point-max)
                                 'button nil))
        candidates)
    (save-excursion
      (while (setq skip (text-property-not-all skip (point-max)
                                               'button nil))
        (goto-char skip)
        (push skip candidates)
        (setq skip (text-property-any (point) (point-max)
                                      'button nil))))
    (nreverse candidates)))

最新更新