Java google风格的缩进emacs文件

时间:2015-07-15 01:43:20

标签: java emacs indentation google-style-guide

我需要在Java应用程序中使用谷歌样式缩进。我被赋予了添加到我的.emacs文件的代码,但它无法正常工作。

当我运行checkstyle代码时,它会给我标签错误。

这是我的.emacs文件包含的内容:

;; .emacs
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(diff-switches "-u")
 '(inhibit-startup-screen t))

;;; uncomment for CJK utf-8 support for non-Asian users
;; (require 'un-define)
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

;;; google conformant indentation for java
(add-hook 'java-mode-hook
          (lambda ()
            (progn
              (setq c-basic-offset 2)
              (c-set-offset 'case-label '+)
              (c-set-offset 'statement-cont '++))))

你能不能告诉我什么是错的,或者指出一个我替换它的文件?

1 个答案:

答案 0 :(得分:0)

您是否重新缩进了Java缓冲区?您可以使用 C-x h TAB