自 it may be a good idea to have lines that are not wider than 80 characters in code files ,使用 Emacs 在现有项目中递归识别这些行的最有效方法是什么?
更新:
根据 Trey 的建议,我目前正在使用以下代码:
(defun find-long-lines (base-dir)
"Recursively look for lines longer than 80 characters files"
(interactive "DPath:")
(grep-compute-defaults)
(rgrep "^................................................................................." "*" base-dir))
与 结合使用效果很好空白模式 .
最佳答案
我无法列出 EMACS 特定的解决方案,但是您可以稍微更改命令以包含文件名(并且键入更少)。
rgrep "^.\{81\}" . -n (include line numbers)
rgrep "^.\{81\}" . -c (summary view per file)
交互式 rgrep 提示不需要引号。
rgrep
RET
^.{81} RET
文件类型 RET
小路
关于emacs - 在 Emacs 中递归识别超过 80 个字符的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4044488/