- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
函数directory-files
返回 .
和 ..
条目也是如此。虽然在某种意义上确实如此,只有这样函数才能返回所有现有条目,但我还没有看到包含这些条目的用途。另一方面,每次使用 directory-files
我也写类似的东西
(unless (string-match-p "^\\.\\.?$" ...
(unless (or (string= "." entry)
(string= ".." entry))
..)
M-:
)中,额外的代码是不可取的。
最佳答案
您可以将其作为原始函数调用的一部分来执行。
(directory-files DIRECTORY &optional FULL MATCH NOSORT)
If MATCH is non-nil, mention only file names that match the regexp MATCH.
(directory-files (expand-file-name "~/") nil "^\\([^.]\\|\\.[^.]\\|\\.\\..\\)")
(defun my-directory-files (directory &optional full nosort)
"Like `directory-files' with MATCH hard-coded to exclude \".\" and \"..\"."
(directory-files directory full "^\\([^.]\\|\\.[^.]\\|\\.\\..\\)" nosort))
(defun my-directory-files (directory &optional full match nosort)
"Like `directory-files', but excluding \".\" and \"..\"."
(delete "." (delete ".." (directory-files directory full match nosort))))
(defun my-directory-files (directory &optional full match nosort)
"Like `directory-files', but excluding \".\" and \"..\"."
(let* ((files (cons nil (directory-files directory full match nosort)))
(parent files)
(current (cdr files))
(exclude (list "." ".."))
(file nil))
(while (and current exclude)
(setq file (car current))
(if (not (member file exclude))
(setq parent current)
(setcdr parent (cdr current))
(setq exclude (delete file exclude)))
(setq current (cdr current)))
(cdr files)))
关于file - Emacs 口齿不清 : Concise way to get `directory-files` without "." and ".."?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17164767/
现在我可以将子例程 printargs 命名如下来获取转储。 perl -MO=Concise,printargs,-main,-terse Hello.pl 假设我有几个子例程,我如何构建一个通用模
我想问一个问题,关于Play中JSON验证最简洁的方式!框架 在官方 Play 教程中,我找到了有关 JSON Macro Inception 的主题。它的序列化/反序列化的主要思想看起来很不错: i
我正在尝试 MaybeT monad,特别是 MaybeT Identity String import Control.Monad.Trans.Maybe import Control.Monad.
我是 android 的新手,我正在尝试为一个项目获取这个特定的布局,但我想知道是否有更简单的方法,我已经添加了 .xml 文件的代码以及图像我想要的布局。我也进行了一些查询搜索,但大多数最终得到的解
检查下面的示例代码 var Syntax = { /* eslint should throw error for this */ concise () { console.log("
我在 foreach 中有以下 if else 语句环形: string date = GetDate(item) if (date == null) { continue; } else {
我经常遇到将所有 JavaScript 放在 namespace 结构中的网站,如下所示: namespaces = { com : { example: { example.com's data}
我目前正在尝试以递归方式删除一个目录...奇怪的是,我能找到的最短的代码片段是以下构造,采用 ad-hoc 内部类 并在 访客模式... Path rootPath = Paths.get("data
我正在尝试使用 data.table 简洁地计算一些百分比变化,但是我在完全理解 .SD 操作的工作原理时遇到了一些麻烦。 假设我有下表 dt = structure(list(type = c("A
在 Isabelle/HOL 中,我可以用 (SOME _. True) 表示任何类型的任意(但固定)值。有没有更简洁的表示法? 最佳答案 未定义 (我希望我可以只写上面的内容,但答案必须超过 9 个
Structure and Interpretation of Computer Programs 给出了阿克曼函数的实现: (define (A x y) (cond ((= y 0) 0)
今天我一直在使用 Boost::shared_ptr,我有一个问题。 vector > vec; vec.push_back(shared_ptr(new KlasaB)); vec.push_bac
我正在尝试使用 AJAX 提交一个简单的表单。我使用 grunt 作为任务运行程序来编译我的 JS 文件等。 这是我到目前为止所做的。 $("form").submit(function(event)
一段时间以来,我一直在努力研究过滤对象数组,但我似乎无法真正掌握它。虽然我通常最后会有工作代码,但对我来说它看起来不像是优雅的代码。所以,我非常感谢代码审查和一些提示! 示例:我目前正在为一家在线商店
我正在尝试编写一个非常简单的表单理解列表 [initial-expression for name in collection if condition(initial-expression)] 但我
在 Python 中,我经常发现自己编写了以下稍微笨拙的代码: if data['name'] is not None: name = data['name'] # do stuff
我有一个看起来像这样的列表列表: [['Tom', 'Dick'], ['Harry', 'John', 'Mike'], ['Bob']] 我想把它变成一个字典,其中每个键都是一个名称,每个值都是一
我想找到一种使用 Material-UI 在我的应用中轻松定义便利组件的方法。 我从 Material-UI doco for Appbar 复制了一个例子并尝试引入一些 React 组件以增加可读性
我正在寻找一个正则表达式,它只返回字符串“A :B C:D”的三个匹配组其中 A、B、C、D 是单词示例 (\w+)以下 Python 代码打印不需要的 (None,None)。 我只想 ('A',N
函数directory-files返回 .和 ..条目也是如此。虽然在某种意义上确实如此,只有这样函数才能返回所有现有条目,但我还没有看到包含这些条目的用途。另一方面,每次使用 directory-f
我是一名优秀的程序员,十分优秀!