I added the following at the end of my ~/.spacemacs
file:
(use-package flycheck
:defer t
:init (global-flycheck-mode))
When I do this, I get Spacemacs encountered an error while loading your '/home/brandon/.spacemacs' file
.
How can I debug this error?
Also, is there a way to get more descriptive errors?
Answer to error sub-question in comments: use emacs --debug-init
.
Update
The output I get when using --debug-init
is:
Debugger entered--Lisp error: (void-function use-package)
(use-package flycheck :defer t :init (global-flycheck-mode))
eval-buffer(#<buffer *load*-76993> nil "/home/brandon/.spacemacs" nil t) ; Reading at buffer position 18437
load-with-code-conversion("/home/brandon/.spacemacs" "/home/brandon/.spacemacs" nil nil)
load("/home/brandon/.spacemacs")
(condition-case err (load dotspacemacs) ((debug error) (message "Error loading .spacemacs: %S" err) nil))
(if (condition-case err (load dotspacemacs) ((debug error) (message "Error loading .spacemacs: %S" err) nil)) nil (dotspacemacs/safe-load))
(if (file-exists-p dotspacemacs) (if (condition-case err (load dotspacemacs) ((debug error) (message "Error loading .spacemacs: %S" err) nil)) nil (dotspacemacs/safe-load)))
(let ((dotspacemacs (dotspacemacs/location))) (if (file-exists-p dotspacemacs) (if (condition-case err (load dotspacemacs) ((debug error) (message "Error loading .spacemacs: %S" err) nil)) nil (dotspacemacs/safe-load))))
dotspacemacs/load-file()
spacemacs/init()
(if (not (version<= spacemacs-emacs-min-version emacs-version)) (error (concat "Your version of Emacs (%s) is too old. " "Spacemacs requires Emacs version %s or above.") emacs-version spacemacs-emacs-min-version) (load-file (concat (file-name-directory load-file-name) "core/core-load-paths.el")) (require 'core-spacemacs) (spacemacs/init) (configuration-layer/sync) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (require 'server) (if (server-running-p) nil (server-start)))
eval-buffer(#<buffer *load*> nil "/home/brandon/.emacs.d/init.el" nil t) ; Reading at buffer position 1264
load-with-code-conversion("/home/brandon/.emacs.d/init.el" "/home/brandon/.emacs.d/init.el" t t)
load("/home/brandon/.emacs.d/init" t t)
#f(compiled-function () #<bytecode 0x25d5e9>)()
command-line()
normal-top-level()
Tentative Solution
After looking around a bit more, I realized my config was in the wrong part of the ~/.spacemacs
file. This is probably not the best place for it, but I ended up adding the following in my (defun dotspacemacs/user-config ()
... )
.
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
Also, I now note that flycheck complains that the line with (use-package flycheck
has a reference to free variable
flycheck' (emacs-lisp)` ... hmm. But, a step in the right direciton.
--debug-init
option to get a backtrace. – MTS Jan 16 '19 at 21:33use-package
the:init
keyword is for code to be executed before the package is loaded. We can assumeglobal-flycheck-mode
is defined in the package, if it is being found, it is probably for some other reason. So, you should probably move that to:config
and remove:defer
if I understand what you want correctly. But your error message complains aboutuse-package
being undefined. Have you loadeduse-package
itself in your init file? – gusbrs Jan 19 '19 at 15:30