【问题标题】:Java google-style indentation emacs fileJava google 风格的缩进 emacs 文件
【发布时间】:2015-07-15 01:43:19
【问题描述】:

我需要在 Java 应用程序中使用 google 样式的缩进。我获得了要添加到我的 .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 '++))))

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

【问题讨论】:

    标签: java emacs indentation google-style-guide


    【解决方案1】:

    您是否重新缩进了 Java 缓冲区?你可以用 C-x h TAB 来做到这一点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-20
      相关资源
      最近更新 更多