【发布时间】:2011-05-01 23:08:17
【问题描述】:
由于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))
与 whitespace-mode 结合使用效果很好。
【问题讨论】:
-
不是一个完整的解决方案,但
occur需要一个正则表达式,因此您可以使用occur来识别超过 80 个字符的行,它们将显示在一个漂亮的缓冲区中,您可以在其中单击它们和 Emacs 会自动跳转到相应的行。
标签: emacs coding-style