flymake-google-cpplint-filter或linelength似乎没有抓住我的emacs文件

时间:2014-08-12 19:20:44

标签: emacs flymake cpplint

我在emacs 24中安装了以下软件包 flymake-google-cpplint是一个已安装的软件包。

 Status: Installed in `/home/myname/.emacs.d/elpa/flymake-google-cpplint-20140205.525/'.
Version: 20140205.525

在我的emacs中我有以下内容,

; start flymake-google-cpplint-load
; let's define a function for flymake initialization
(defun my:flymake-google-init () 
  (require 'flymake-google-cpplint)
  (custom-set-variables
   '(flymake-google-cpplint-command "/usr/local/bin/cpplint")
   '(flymake-google-cpplint-verbose "3")
   '(flymake-google-cpplint-linelength "120")
   '(flymake-googlelint-filter "-whitespace/line_length"))
  (flymake-google-cpplint-load)
)
(add-hook 'c-mode-hook 'my:flymake-google-init)
(add-hook 'c++-mode-hook 'my:flymake-google-init)

google-cpplint运行正常,但不是过滤掉whitespace / line_length,cpplint仍然是长行消息,而是大于80个字符的行也会发出警告;虽然我把它设置为警告120个字符。

我已经重启了emacs很多次。并且还尝试了M-X load-file RET并加载了~/.emacs

我在这里错过了一步。我是否需要更改cpplint.py或flymake-google-cpplint.el中的内容才能使更改生效? 感谢

2 个答案:

答案 0 :(得分:1)

你不应该替换:

9: '(flymake-googlelint-filter "-whitespace/line_length"))    

通过

9: '(flymake-google-cpplint-filter "-whitespace/line_length"))

参考: https://github.com/senda-akiha/flymake-google-cpplint/blob/master/flymake-google-cpplint.el

答案 1 :(得分:1)

我遇到了同样的问题。我的修复是只编辑二进制文件以使用正确的标志调用cpplint。我添加了一个可执行文件:

#!/usr/bin/env bash
/usr/local/bin/cpplint --linelength=120 "$@"

as~ / .emacs.d / cpplint并从我的〜/ .emacs中引用

(defun my:google-cpp-lint-init ()
  (require 'flymake-google-cpplint)
  (custom-set-variables
   '(flymake-google-cpplint-command "~/.emacs.d/cpplint")
  )
  (flymake-google-cpplint-load)
)