是否有任何库或函数可以为 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/