-1

我需要在 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 '++))))

您能否告诉我出了什么问题,或者指向我要替换它的文件?

4

1 回答 1

0

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

于 2015-07-16T08:05:34.520 回答