Spacemacs 0.300 无法正常设置 c-basic-offset

config:

(setq c-basic-offset 4)
(setq tab-width 4)
(c-set-offset 'case-label 4)

这两天升级到 0.300 发现 c/cpp 缩进变成 2 了,也尝试过 setq-default

Space+h+d+v 显示

c-basic-offset is a variable defined in ‘cc-vars.el’.
Its value is 2
Original value was set-from-style
Local in buffer A.cpp; global value is 4

System Info :computer:

  • OS: darwin
  • Emacs: 25.3.1
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. b4d663dc)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(helm osx nlinum
      (chinese :variables chinese-enable-fcitx t)
      dash git github pandoc
      (c-c++ :variables c-c++-default-mode-for-headers 'c++-mode c-c++-enable-clang-support nil)
      emacs-lisp
      (markdown :variables markdown-command "pandoc -t html5 -f markdown -s -S --mathjax --highlight-style=pygments --toc --toc-depth 3 --template github.html5 --css html/css/github.css" markdown-live-preview-engine 'pandoc)
      (org :variables org-agenda-files
           '("~/Documents/Org")
           org-directory '"~/Documents/Org" org-projectile-file "TODOs.org" org-want-todo-bindings t)
      (python :variables python-enable-yapf-format-on-save t)
      (auto-completion :variables auto-completion-enable-help-tooltip 'manual auto-completion-enable-snippets-in-popup t auto-completion-enable-sort-by-usage t :disabled-for org markdown)
      (shell :variables shell-default-shell 'multi-term shell-default-height 80 shell-default-position 'bottom)
      (syntax-checking :variables flycheck-delayed-errors-timeout 500)
      cfg)
  • System configuration features: NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS

看mode-hook,global 4 & buffer-local 2,肯定是spacemacs加了个hook改掉了

看看他的hook函数内容自己需要不,都不要就remove-hook,要的就自己加个hook改回来。(add-hook HOOK FUNCTION &optional APPEND LOCAL)注意APPENDt,确保自己这个最后执行。

嗯,谢谢,找到原因了,因为 package 中加了一个 google-c-style