如何解决 “More than one init function found for package"

hi 我的 spacemacs 每次启动都要抛出一对这样的Warning。

(Spacemacs) Warning: More than one init function found for package

可能是多个layer 里面 多次init 同一个 package. 这个问题如何解决?

(Spacemacs) Warning: More than one init function found for package company-quickhelp. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package auto-complete. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package ac-ispell. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package company. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package company-statistics. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package helm-company. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package helm-c-yasnippet. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package hippie-exp. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package yasnippet. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package auto-yasnippet. Previous owner was auto-completion, replacing it with layer auto-completion.
(Spacemacs) Warning: More than one init function found for package company-ycmd. Previous owner was ycmd, replacing it with layer ycmd.
(Spacemacs) Warning: More than one init function found for package flycheck-ycmd. Previous owner was ycmd, replacing it with layer ycmd.
(Spacemacs) Warning: More than one init function found for package ycmd. Previous owner was ycmd, replacing it with layer ycmd.

最好格式化一下你的 log 信息吧,现在看不太清楚。

一般来说,如果出现这种警告,首先看看是 spacemacs 引起的,还是你自己引起的。

一个 package 只能有一个 init,如果官方的 Layer 包含了该 package,那么你只需要在自己的 layer 里面使用 post-init-xxx 就好了。

不好意思, 贴上去格式乱了, 内容是相似的,而且不是我自己的package init (Spacemacs) Warning: More than one init function found for package company-quickhelp. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package auto-complete. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package ac-ispell. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package company. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package company-statistics. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package helm-company. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package helm-c-yasnippet. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package hippie-exp. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package yasnippet. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package auto-yasnippet. Previous owner was auto-completion, replacing it with layer auto-completion.

(Spacemacs) Warning: More than one init function found for package company-ycmd. Previous owner was ycmd, replacing it with layer ycmd.

(Spacemacs) Warning: More than one init function found for package flycheck-ycmd. Previous owner was ycmd, replacing it with layer ycmd.

(Spacemacs) Warning: More than one init function found for package ycmd. Previous owner was ycmd, replacing it with layer ycmd.

Done, @zhongke 把 Log 放到代码块里看起来好一些,Markdown 中的换行排版时不会被保留。

建议检查一下 dotspacemacs-configuration-layers 中是不是有重复的layer。

   dotspacemacs-configuration-layers
   '(
     ;; ----------------------------------------------------------------
     ;; Example of useful layers you may want to use right away.
     ;; Uncomment some layer names and press <SPC f e R> (Vim style) or
     ;; <M-m f e R> (Emacs style) to install them.
     ;; ----------------------------------------------------------------
     ;;spacemacs-helm
     auto-completion 
     (auto-completion :variables
                      auto-completion-enable-snippets-in-popup t)
     better-defaults
     emacs-lisp
     cscope
     git
     markdown
     org
     gtags
     semantic
     deft
     ycmd
     ;;emacs-ycmd

     (ycmd :variables
           ycmd-server-command '("python" "/home/kevin/git/ycmd/ycmd/")
           ;;ycmd-global-config '("/home/kevin/git/ycmd/ycmd/global_config.py")
           ycmd-extra-conf-whitelist '("/home/kevin/git/leveldb/*")
           )


     (c-c++ : variables
            c-c++-default-mode-for-headers 'c++-mode
            c-c++-enable-clang-support t)
     ;; (shell :variables
     ;;        shell-default-height 30
     ;;        shell-default-position 'bottom)
     flycheck
     spell-checking
     syntax-checking
     version-control
     )

这是我所有的layer

似乎有两个 auto-completion layer, 两个 ycmd layer, 你各去掉一个应该就正常了。

还有 spacemacs 并没有提供 flycheck 的 layer(Spacemacs 提供了 SPC h l 的快捷键来浏览所有 layer 的文档), syntax-checking 中包含了 flycheck, 你配置中的 flycheck 可以删掉。

It has been fixed, thank you very much!