emacs - 在 Emacs 中递归识别超过 80 个字符的行

标签 emacs coding-style

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/

相关文章:

c - 如何使 Emacs 正确缩进 C99 复合文字?

binding - 使用 Clojure 在运行时动态绑定(bind)函数

c# - 'using' 应该在命名空间内部还是外部?

git - magit:如何在同一分支上的两个不同提交之间区分同一文件?

emacs - OS X 10.9 上的 hunspell/emacs

c++ - 具有 DLL 导出规范的 C++ 类中的 emacs 缩进不正确

emacs - 如何修复 spacemacs importmagic 和/或 epc 未找到?

java - 明确比较 boolean 常量是否很糟糕,例如如果(b == false)在Java中?

ruby - 为什么喜欢使用 %w 而不是 ['foo'、 'bar']

c# - 在 VB.NET 中使用 Dim foo As Foo 有问题吗?