1

我在 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 运行良好,但不是过滤掉空格/line_length,cpplint 仍然在长行上显示消息,并且在超过 80 个字符的行上它也会发出警告;尽管我将其设置为 120 个字符时发出警告。

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

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

4

2 回答 2

1

我有同样的问题。我的解决方法是只编辑二进制文件以使用正确的标志调用 cpplint。我添加了一个可执行文件:

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

作为 ~/.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)
)
于 2015-01-26T23:03:55.787 回答
1

Shouldn't you replace:

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

by

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

?

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

于 2014-12-04T17:09:25.330 回答