locate-dominating-file 记录在哪里?

Where is locate-dominating-file documented?

我一直在寻找一种在 emacs 中设置默认编译目录的方法,并找到了一个很好的答案 here

但是我想知道如果没有 google 我怎么会 知道 这个功能。以下是我所知道的有关该文档 emacs 和 elisp 的当前 官方 来源。

  1. emacs manual
  2. elisp manual
  3. emacs 本身 M-x 描述函数 M-x 描述变量

如果我知道我在搜索什么,找到文档很容易:

M-x describe-function locate-dominating-file returns

locate-dominating-file is a compiled Lisp function in ‘files.el’.

(locate-dominating-file FILE NAME)

Look up the directory hierarchy from FILE for a directory containing NAME.
Stop at the first parent directory containing a file NAME,
and return the directory.  Return nil if not found.
Instead of a string, NAME can also be a predicate taking one argument
(a directory) and returning a non-nil value if that directory is the one for
which we’re looking.

emacs 和 elisp 手册(上面发布)似乎没有 locate-dominating-file 记录。


这是我的问题:

我怎么 发现 locate-dominating-file 甚至在没有 google 的情况下也存在?截至目前,对于这个特定功能 (locate-dominating-file),我发现它的唯一方法(没有 google)似乎是实际打开 files.el 并熟悉源代码。这真的是唯一的方法还是我错过了其他一些明显的来源?

尝试

M-xapropos 搜索所有列表符号

C-h d 搜索所有文档字符串

我认为找到这些东西的一个好方法是寻找已经以与您想要的方式相似的方式运行的东西,然后查看它们的代码。

例如VC 需要查找 .git/.hg/.svn 子目录以确定文件是否受版本控制,因此您可以尝试查看 VC 代码。或者在父目录中类似地查找 .dir-locals.el 文件,因此您可以查看实现此功能的代码。

也就是说,它并不总是有效,但 Emacs 试图让查找和查看您所看到的东西的源代码变得非常容易。