lisp - emacs lisp 列出带有 glob 扩展的文件

标签 lisp elisp

是否有任何库或函数可以为 emacs lisp 执行类似 bash 的 glob 扩展?

例如:

(directory-files-glob "~/Desktop/*")
> ("/home/user/Desktop/file1" "/home/user/Desktop/file2")

如果没有这样的功能,是否有关于如何实现它的任何提示/建议?

编辑:

我在 docs 中找到了也是一个非常有用的功能,完全可以做到这一点:

file-expand-wildcards: This function expands the wildcard pattern pattern, returning a list of file names that match it.

最佳答案

不知道为什么这被忽略了,也许它在 2010 年不在 emacs 中,但在当前的 emacs 中至少有函数 file-expand-wildcards

(file-expand-wildcards "~/Desktop/*")

这正是你想做的..

关于lisp - emacs lisp 列出带有 glob 扩展的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3515152/

相关文章:

haskell - Lisp 中复制 Mathematica 功能的替换函数

emacs:将数字行的绑定(bind)切换为等效的 <shift>-ed

Emacs/AUCTeX : run command on file that is not currently open

linux - 如何检查框架中或终端中的 emacs?

emacs - 如何在 emacs 的文件名中匹配关键字条件

emacs - ACT-R 不重新加载模型

Lisp 链接函数宏

emacs - 如何防止Emacs设置撤消边界?

emacs 的 Javascript 实现

Emacs,探测任意键映射