syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.68k stars 4.89k forks source link

Symbol’s value as variable is void: evil-evilified-state-map #16619

Open c02y opened 4 days ago

c02y commented 4 days ago

Unable to use SPC h I since emacs starts with Error message:

⛔ Error (use-package): Cannot load evil-evilified-state
⛔ Warning (initialization): An error occurred while loading ‘/home/chz/.emacs.d/init.el’:

Symbol's value as variable is void: evil-evilified-state-map

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

emacs version: emacs-native-comp-git 31.0.50.175165-1 OS: Archlinux Already tried to update all the packages but failed at the end because of evil-evilified-state-map error

This happens when I tried to upgrade my emacs package from emacs-git-30.0.50.166798-2 to emacs-native-comp-git 31.0.50.175165-1

I've tried emacs-nativecomp 29.4-3, it is working fine.

smile13241324 commented 1 day ago

@sunlin7 can you have a look at this ticket? I remember you were already on Emacs 31. Maybe there is an incompatibility in our code.

sunlin7 commented 1 day ago

@smile13241324 Yes, I'm on Emacs 31 with native-comp enabled. @c02y Could you start emacs with --debug-init then should be able to get the backtrack, that will more helpful, thanks.

c02y commented 1 day ago

I use ~/.emacs.d/core/templates/.spacemacs.template as ~/.spacemacs, here is the emacs --debug-init:

Debugger entered--Lisp error: (void-variable evil-evilified-state-map)
  (define-key evil-evilified-state-map (kbd dotspacemacs-leader-key) spacemacs-default-map)
  spacemacs-bootstrap/init-evil-evilified-state()
  funcall(spacemacs-bootstrap/init-evil-evilified-state)
  (let* ((pkg-name (eieio-oref pkg ':name)) (owner (car (eieio-oref pkg ':owners)))) (spacemacs-buffer/message (format "%S -> init (%S)..." pkg-name owner)) (funcall (intern (format "%S/init-%S" owner pkg-name))))
  configuration-layer//configure-package(#<cfgl-package cfgl-package-1e787cfd13bf>)
  mapc(configuration-layer//configure-package (#<cfgl-package cfgl-package-1e787cfd13c2> #<cfgl-package cfgl-package-1e787cfd13bf> #<cfgl-package cfgl-package-1e787cfd1c4a> #<cfgl-package cfgl-package-1e787cfd1c67> #<cfgl-package cfgl-package-1e787cfd1dc9>))
  (let (packages-to-configure) (let ((tail packages)) (while tail (let ((pkg-name (car tail))) (let ((pkg (configuration-layer/get-package pkg-name))) (cond ((eieio-oref pkg ...) (spacemacs-buffer/message ...)) ((and ... ...) (spacemacs-buffer/message ...)) ((null ...) (spacemacs-buffer/message ...)) ((not ...) (spacemacs-buffer/message ...)) ((not ...) (spacemacs-buffer/message ...)) (t (let ... ...) (if ... nil ...) (cond ... ...)))) (setq tail (cdr tail))))) (setq packages-to-configure (reverse packages-to-configure)) (mapc 'configuration-layer//configure-package packages-to-configure) (mapc 'configuration-layer//post-configure-package packages-to-configure))
  configuration-layer//configure-packages-2((dotenv-mode evil-evilified-state holy-mode hybrid-mode pcre2el which-key-posframe))
  configuration-layer//configure-packages((abbrev ace-jump-helm-line ace-link ace-window aggressive-indent all-the-icons ansi-colors archive-mode async auto-compile auto-highlight-symbol avy bind-key bind-map bookmark buffer-menu centered-cursor-mode clean-aindent-mode column-enforce-mode compile conf-mode cus-edit dash debug default-helm-config default-ivy-config default-org-config define-word desktop devdocs diminish dired dired-quick-sort dired-x disable-mouse display-fill-column-indicator display-line-numbers doc-view doom-modeline dotenv-mode drag-stuff dumb-jump edebug ediff editorconfig eldoc electric-indent-mode elisp-def elisp-demos elisp-slime-nav ...))
  configuration-layer//load()
  (cond (changed-since-last-dump-p (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message "Layer list has changed since last dump.") (configuration-layer//dump-emacs)))) (spacemacs-force-dump (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "--force-dump passed on the command line or configuration has " "been reloaded, forcing a redump.")) (configuration-layer//dump-emacs)))) ((spacemacs-is-dumping-p) (configuration-layer//load)) ((and (spacemacs/emacs-with-pdumper-set-p) (spacemacs-run-from-dump-p)) (configuration-layer/message "Running from a dumped file. Skipping the loading process!")) (t (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "Layer list has not changed since last time. " "Skipping dumping process!"))))))
  (let (changed-since-last-dump-p) (if (file-exists-p configuration-layer--last-dotspacemacs-configuration-layers-file) (progn (configuration-layer/load-file configuration-layer--last-dotspacemacs-configuration-layers-file))) (let ((layers dotspacemacs-configuration-layers)) (progn (if "Calling dotfile layers..." (progn (spacemacs-buffer/message "Calling dotfile layers..."))) (if (fboundp 'dotspacemacs/layers) (progn (condition-case err (dotspacemacs/layers) ((debug error) (configuration-layer//increment-error-count) (spacemacs-buffer/append ... t)))))) (setq dotspacemacs--configuration-layers-saved dotspacemacs-configuration-layers) (setq changed-since-last-dump-p (not (equal layers dotspacemacs-configuration-layers))) (spacemacs/dump-vars-to-file '(dotspacemacs-configuration-layers) configuration-layer--last-dotspacemacs-configuration-layers-file)) (cond (changed-since-last-dump-p (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message "Layer list has changed since last dump.") (configuration-layer//dump-emacs)))) (spacemacs-force-dump (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "--force-dump passed on the command line or configuration has " "been reloaded, forcing a redump.")) (configuration-layer//dump-emacs)))) ((spacemacs-is-dumping-p) (configuration-layer//load)) ((and (spacemacs/emacs-with-pdumper-set-p) (spacemacs-run-from-dump-p)) (configuration-layer/message "Running from a dumped file. Skipping the loading process!")) (t (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "Layer list has not changed since last time. " "Skipping dumping process!")))))))
  configuration-layer/load()
  (let ((please-do-not-disable-file-name-handler-alist nil)) (require 'core-spacemacs) (spacemacs/dump-restore-load-path) (configuration-layer/load-lock-file) (spacemacs/init) (configuration-layer/stable-elpa-init) (configuration-layer/load) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (spacemacs/dump-eval-delayed-functions) (if (and dotspacemacs-enable-server (not (spacemacs-is-dumping-p))) (progn (require 'server) (if dotspacemacs-server-socket-dir (progn (setq server-socket-dir dotspacemacs-server-socket-dir))) (if (server-running-p) nil (message "Starting a server...") (server-start)))))
  (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) (let ((please-do-not-disable-file-name-handler-alist nil)) (require 'core-spacemacs) (spacemacs/dump-restore-load-path) (configuration-layer/load-lock-file) (spacemacs/init) (configuration-layer/stable-elpa-init) (configuration-layer/load) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (spacemacs/dump-eval-delayed-functions) (if (and dotspacemacs-enable-server (not (spacemacs-is-dumping-p))) (progn (require 'server) (if dotspacemacs-server-socket-dir (progn (setq server-socket-dir dotspacemacs-server-socket-dir))) (if (server-running-p) nil (message "Starting a server...") (server-start))))))
  load-with-code-conversion("/home/chz/.emacs.d/init.el" "/home/chz/.emacs.d/init.el" t t)
  load("/home/chz/.emacs.d/init" noerror nomessage)
  #f(compiled-function () #<bytecode 0x17fc20916b449011>)()
  #f(compiled-function () #<bytecode -0x4307d7bb01d2857>)()
  handler-bind-1(#f(compiled-function () #<bytecode -0x4307d7bb01d2857>) (error) startup--debug)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0xb5ba406f98c937f>) #f(compiled-function () #<bytecode 0x731968ef8c7b19b>) t)
  command-line()
  normal-top-level()
sunlin7 commented 13 hours ago

The evil-evilified-state-map is defined in macro evil-define-state in evil-evilified-state.el line 60, https://github.com/syl20bnr/spacemacs/blob/1f115306233b3e508ae259fd864e0f46e2b0a0a2/layers/%2Bdistributions/spacemacs-bootstrap/local/evil-evilified-state/evil-evilified-state.el#L60-L61 The function spacemacs-bootstrap/init-evil-evilified-state will use the evil-evilified-state package, then define the key (define-key evil-evilified-state-map (kbd dotspacemacs-leader-key) spacemacs-default-map).

And it maybe caused by some *.elc files from mismatched version of Emacs.

Could you remove all the .elc files and try again? (To find all .elc used by Emacs can be done with "strace").

Maybe related ticket: https://github.com/syl20bnr/spacemacs/issues/16514

c02y commented 4 hours ago

I did these, should be more enough than remove all the *.elc files

  1. remove ~/.emacs.d and ~/.spacemacs.env
  2. start fresh install using git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d -b develop,
  3. then cp ~/.emacs.d/core/templates/.spacemacs.template ~/.spacemacs
  4. emacs to install the package, it failed
  5. emacs --debug-init

Here is the emacs --debug-init result:

Debugger entered--Lisp error: (void-variable evil-evilified-state-map)
  (define-key evil-evilified-state-map (kbd dotspacemacs-leader-key) spacemacs-default-map)
  spacemacs-bootstrap/init-evil-evilified-state()
  funcall(spacemacs-bootstrap/init-evil-evilified-state)
  (let* ((pkg-name (eieio-oref pkg ':name)) (owner (car (eieio-oref pkg ':owners)))) (spacemacs-buffer/message (format "%S -> init (%S)..." pkg-name owner)) (funcall (intern (format "%S/init-%S" owner pkg-name))))
  configuration-layer//configure-package(#<cfgl-package cfgl-package-1e4e5735df2e>)
  mapc(configuration-layer//configure-package (#<cfgl-package cfgl-package-1e4e5735df35> #<cfgl-package cfgl-package-1e4e5735df2e> #<cfgl-package cfgl-package-1e4e5735c4ed> #<cfgl-package cfgl-package-1e4e5735c4f6> #<cfgl-package cfgl-package-1e4e5735c4c0>))
  (let (packages-to-configure) (let ((tail packages)) (while tail (let ((pkg-name (car tail))) (let ((pkg (configuration-layer/get-package pkg-name))) (cond ((eieio-oref pkg ...) (spacemacs-buffer/message ...)) ((and ... ...) (spacemacs-buffer/message ...)) ((null ...) (spacemacs-buffer/message ...)) ((not ...) (spacemacs-buffer/message ...)) ((not ...) (spacemacs-buffer/message ...)) (t (let ... ...) (if ... nil ...) (cond ... ...)))) (setq tail (cdr tail))))) (setq packages-to-configure (reverse packages-to-configure)) (mapc 'configuration-layer//configure-package packages-to-configure) (mapc 'configuration-layer//post-configure-package packages-to-configure))
  configuration-layer//configure-packages-2((dotenv-mode evil-evilified-state holy-mode hybrid-mode pcre2el which-key-posframe))
  configuration-layer//configure-packages((abbrev ace-jump-helm-line ace-link ace-window aggressive-indent all-the-icons ansi-colors archive-mode async auto-compile auto-highlight-symbol avy bind-key bind-map bookmark buffer-menu centered-cursor-mode clean-aindent-mode column-enforce-mode compile conf-mode cus-edit dash debug default-helm-config default-ivy-config default-org-config define-word desktop devdocs diminish dired dired-quick-sort dired-x disable-mouse display-fill-column-indicator display-line-numbers doc-view doom-modeline dotenv-mode drag-stuff dumb-jump edebug ediff editorconfig eldoc electric-indent-mode elisp-def elisp-demos elisp-slime-nav ...))
  configuration-layer//load()
  (cond (changed-since-last-dump-p (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message "Layer list has changed since last dump.") (configuration-layer//dump-emacs)))) (spacemacs-force-dump (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "--force-dump passed on the command line or configuration has " "been reloaded, forcing a redump.")) (configuration-layer//dump-emacs)))) ((spacemacs-is-dumping-p) (configuration-layer//load)) ((and (spacemacs/emacs-with-pdumper-set-p) (spacemacs-run-from-dump-p)) (configuration-layer/message "Running from a dumped file. Skipping the loading process!")) (t (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "Layer list has not changed since last time. " "Skipping dumping process!"))))))
  (let (changed-since-last-dump-p) (if (file-exists-p configuration-layer--last-dotspacemacs-configuration-layers-file) (progn (configuration-layer/load-file configuration-layer--last-dotspacemacs-configuration-layers-file))) (let ((layers dotspacemacs-configuration-layers)) (progn (if "Calling dotfile layers..." (progn (spacemacs-buffer/message "Calling dotfile layers..."))) (if (fboundp 'dotspacemacs/layers) (progn (condition-case err (dotspacemacs/layers) ((debug error) (configuration-layer//increment-error-count) (spacemacs-buffer/append ... t)))))) (setq dotspacemacs--configuration-layers-saved dotspacemacs-configuration-layers) (setq changed-since-last-dump-p (not (equal layers dotspacemacs-configuration-layers))) (spacemacs/dump-vars-to-file '(dotspacemacs-configuration-layers) configuration-layer--last-dotspacemacs-configuration-layers-file)) (cond (changed-since-last-dump-p (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message "Layer list has changed since last dump.") (configuration-layer//dump-emacs)))) (spacemacs-force-dump (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "--force-dump passed on the command line or configuration has " "been reloaded, forcing a redump.")) (configuration-layer//dump-emacs)))) ((spacemacs-is-dumping-p) (configuration-layer//load)) ((and (spacemacs/emacs-with-pdumper-set-p) (spacemacs-run-from-dump-p)) (configuration-layer/message "Running from a dumped file. Skipping the loading process!")) (t (configuration-layer//load) (if (spacemacs/emacs-with-pdumper-set-p) (progn (configuration-layer/message (concat "Layer list has not changed since last time. " "Skipping dumping process!")))))))
  configuration-layer/load()
  (let ((please-do-not-disable-file-name-handler-alist nil)) (require 'core-spacemacs) (spacemacs/dump-restore-load-path) (configuration-layer/load-lock-file) (spacemacs/init) (configuration-layer/stable-elpa-init) (configuration-layer/load) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (spacemacs/dump-eval-delayed-functions) (if (and dotspacemacs-enable-server (not (spacemacs-is-dumping-p))) (progn (require 'server) (if dotspacemacs-server-socket-dir (progn (setq server-socket-dir dotspacemacs-server-socket-dir))) (if (server-running-p) nil (message "Starting a server...") (server-start)))))
  (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) (let ((please-do-not-disable-file-name-handler-alist nil)) (require 'core-spacemacs) (spacemacs/dump-restore-load-path) (configuration-layer/load-lock-file) (spacemacs/init) (configuration-layer/stable-elpa-init) (configuration-layer/load) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (spacemacs/dump-eval-delayed-functions) (if (and dotspacemacs-enable-server (not (spacemacs-is-dumping-p))) (progn (require 'server) (if dotspacemacs-server-socket-dir (progn (setq server-socket-dir dotspacemacs-server-socket-dir))) (if (server-running-p) nil (message "Starting a server...") (server-start))))))
  load-with-code-conversion("/home/chz/.emacs.d/init.el" "/home/chz/.emacs.d/init.el" t t)
  load("/home/chz/.emacs.d/init" noerror nomessage)
  #f(compiled-function () #<bytecode 0xc9871bf1bda9011>)()
  #f(compiled-function () #<bytecode -0x4307d7bb01d2857>)()
  handler-bind-1(#f(compiled-function () #<bytecode -0x4307d7bb01d2857>) (error) startup--debug)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0x195817f2a5c1b37f>) #f(compiled-function () #<bytecode 0x731968ef8c7b19b>) t)
  command-line()
  normal-top-level()

It is basically the same as the old one.