【问题标题】:locate-file function not found in Emacs?在 Emacs 中找不到定位文件功能?
【发布时间】:2011-09-29 07:11:34
【问题描述】:

我想使用 Emacs 中的 locate-file 功能,使用文件名快速查找文件。此链接:http://www.gnu.org/software/emacs/elisp/html_node/Locating-Files.html 表示有一个命令功能 'locate-file' 用于此目的。

但是当我尝试使用此功能时:M-x locate-file 它显示为[No match]。可能是什么问题?

奇怪的是,当函数出现在describe-function

【问题讨论】:

    标签: emacs emacs23


    【解决方案1】:

    Icicles 中使用icicle-locate or icicle-locate-file

    如果您使用的是 GNU/Linux 或 Unix,请使用 icicle-locate,它利用了操作系统命令 locate,它使用由操作系统命令 updatedb 创建的定期更新索引。由于这样的索引,locate(因此icicle-locate)非常快。并且因为这是 Icicles,所以您会获得与您在任何东西(以及更多)中看到的相同的增量模式匹配。

    【讨论】:

    • 在建议完成之前,它们都需要花费大量时间来创建索引。有什么方法可以保持索引生成并准备好使用?
    • icicle-locate 应该不会花时间——它使用外部的locate 命令。该外部命令确实创建并保留了一个(外部)索引。或者更确切地说,创建或更新索引的是外部程序updatedb。通常,updatedb 通过cron 作业定期(例如每天)运行。
    【解决方案2】:

    locate-file 不可交互使用。有很多工具可以用来查找像dired-find 这样的文件。

    【讨论】:

    • dired-find 不能按我想要的方式工作。我只想输入文件名,比如“foo.php”,它应该在给定目录中搜​​索并列出所有文件,如anything plugin。
    • 好吧locate-file当然不会那样做。如果您对任何事情感到满意,请使用它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-01
    • 1970-01-01
    相关资源
    最近更新 更多