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.7k stars 4.9k forks source link

spacemacs-visual loading fill-column-inidicator with unrecognized keyword :spacediminish #15144

Closed freeboson closed 1 year ago

freeboson commented 3 years ago

Description :octocat:

At startup, getting the following message in Warnings:

Error (use-package): Failed to parse package fill-column-indicator: use-package: Unrecognized keyword: :spacediminish

This has also been reported by another user here: https://gitter.im/syl20bnr/spacemacs/archives/2021/08/04

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: Message shows up in Warnings buffer

Expected behaviour: :heart: :smile: No message should show up

System Info :computer:

Backtrace :paw_prints:

smile13241324 commented 2 years ago

Strange this sounds like the use-package extension is not loaded. This is normally done at the bootstrap step so except of there is some custom require logic in your init.el or dotfile this should not happen.

Ok for further debugging please update your spacemacs and emacs packages and rename your dotfile and init.el. Than replace them with clean ones from a fresh spacemacs installation and check if this error persists.

emacs18 commented 2 years ago

I too ran into this problem. In my case :spacediminish is indeed used before it is added to use-package-keywords as follows.

The code for configuration-layer//load function is shown below with line numbers.

configuration-layer//configure-packages is called on line 667 to add :spacediminish keyword to use-package-keywords.

However before we reach line 667, configuration-layer//declare-used-layers is called on line 628 which eventually calls configuration-layer/declare-layer(spacemacs-editing-visual nil) which ends up calling spacemacs-editing-visual/init-indent-guide which refers to :spacediminish.

Thus :spacediminish is used before it is defined (i.e., added to use-package-keywords). Hence the error message.

620 (defun configuration-layer//load ()
621   "Actually load the layers.
622 CHANGEDP non-nil means that layers list has changed since last dump
623 To prevent package from being installed or uninstalled set the variable
624 `spacemacs-sync-packages' to nil."
625   ;; declare used layers then packages as soon as possible to resolve
626   ;; usage and ownership
627   (configuration-layer/discover-layers 'refresh-index)
628   (configuration-layer//declare-used-layers dotspacemacs-configuration-layers)
629   (configuration-layer//declare-used-packages configuration-layer--used-layers)
630   ;; then load the functions and finally configure the layers
631   (configuration-layer//load-layers-files configuration-layer--used-layers
632                                           '("funcs"))
633   (configuration-layer//configure-layers configuration-layer--used-layers)
634   ;; load layers lazy settings
635   (configuration-layer/load-auto-layer-file)
636   ;; install and/or uninstall packages
637   (when spacemacs-sync-packages
638     (let ((packages
639            (append
640             ;; install used packages
641             (configuration-layer//filter-distant-packages
642              configuration-layer--used-packages t
643              '(not (oref pkg :lazy-install)))
644             ;; also install all other packages if requested
645             (when (eq 'all dotspacemacs-install-packages)
646               (let (all-other-packages)
647                 (dolist (layer (configuration-layer/get-layers-list))
648                   (let ((configuration-layer--declared-layers-usedp nil)
649                         (configuration-layer--load-packages-files t))
650                     (configuration-layer/declare-layer layer)
651                     (let* ((obj (configuration-layer/get-layer layer))
652                            (pkgs (when obj (oref obj :packages))))
653                       (configuration-layer/make-packages-from-layers
654                        (list layer))
655                       (dolist (pkg pkgs)
656                         (let ((pkg-name (if (listp pkg) (car pkg) pkg)))
657                           (add-to-list 'all-other-packages pkg-name))))))
658                 (configuration-layer//filter-distant-packages
659                  all-other-packages nil))))))
660       (configuration-layer//install-packages packages)
661       (when (and (or (eq 'used dotspacemacs-install-packages)
662                      (eq 'used-only dotspacemacs-install-packages))
663                  (not configuration-layer-force-distribution)
664                  (not configuration-layer-exclude-all-layers))
665         (configuration-layer/delete-orphan-packages packages))))
666   ;; configure used packages
667   (configuration-layer//configure-packages configuration-layer--used-packages)
668   ;; evaluate layer variables a second time to override default values set in
669   ;; packages configuration above
670   (configuration-layer//set-layers-variables configuration-layer--used-layers)
671   (configuration-layer//load-layers-files configuration-layer--used-layers
672                                           '("keybindings"))
673   (when (spacemacs-is-dumping-p)
674     ;; dump stuff in layers
675     (dolist (layer-name configuration-layer--used-layers)
676       (let ((layer-dump-func (intern (format "%S/pre-dump" layer-name))))
677         (when (fboundp layer-dump-func)
678           (configuration-layer/message "Pre-dumping layer %S..." layer-name)
679           (funcall layer-dump-func))))
680     (dotspacemacs|call-func dotspacemacs/user-load
681                             "Calling dotfile user-load...")))
emacs18 commented 2 years ago

The full stack trace of the error is shown below.

Debugger entered--Lisp error: (error "use-package: Unrecognized keyword: :spacediminish")
  signal(error ("use-package: Unrecognized keyword: :spacediminish"))
  error("use-package: %s" "Unrecognized keyword: :spacediminish")
  use-package-normalize-plist(indent-guide (:spacediminish (" ⓘ" " i")) nil use-package-merge-keys)
  use-package-normalize-plist(indent-guide (:init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")) nil use-package-merge-keys)
  use-package-normalize-plist(indent-guide (:custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")) nil use-package-merge-keys)
  use-package-normalize-plist(indent-guide (:defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")) nil use-package-merge-keys)
  use-package-normalize-keywords(indent-guide (:defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")))
  #f(compiled-function (name &rest args) "Declare an Emacs package by specifying a group of configuration options.\n\nFor full documentation, please see the README file that came with\nthis file.  Usage:\n\n  (use-package package-name\n     [:keyword [option]]...)\n\n:init            Code to run before PACKAGE-NAME has been loaded.\n:config          Code to run after PACKAGE-NAME has been loaded.  Note that\n                 if loading is deferred for any reason, this code does not\n                 execute until the lazy load has occurred.\n:preface         Code to be run before everything except `:disabled'; this\n                 can be used to define functions for use in `:if', or that\n                 should be seen by the byte-compiler.\n\n:mode            Form to be added to `auto-mode-alist'.\n:magic           Form to be added to `magic-mode-alist'.\n:magic-fallback  Form to be added to `magic-fallback-mode-alist'.\n:interpreter     Form to be added to `interpreter-mode-alist'.\n\n:commands        Define autoloads for commands that will be defined by the\n                 package.  This is useful if the package is being lazily\n                 loaded, and you wish to conditionally call functions in your\n                 `:init' block that are defined in the package.\n:hook            Specify hook(s) to attach this package to.\n\n:bind            Bind keys, and define autoloads for the bound commands.\n:bind*           Bind keys, and define autoloads for the bound commands,\n                 *overriding all minor mode bindings*.\n:bind-keymap     Bind a key prefix to an auto-loaded keymap defined in the\n                 package.  This is like `:bind', but for keymaps.\n:bind-keymap*    Like `:bind-keymap', but overrides all minor mode bindings\n\n:defer           Defer loading of a package -- this is implied when using\n                 `:commands', `:bind', `:bind*', `:mode', `:magic', `:hook',\n                 `:magic-fallback', or `:interpreter'.  This can be an integer,\n                 to force loading after N seconds of idle time, if the package\n                 has not already been loaded.\n:after           Delay the use-package declaration until after the named modules\n                 have loaded. Once load, it will be as though the use-package\n                 declaration (without `:after') had been seen at that moment.\n:demand          Prevent the automatic deferred loading introduced by constructs\n                 such as `:bind' (see `:defer' for the complete list).\n\n:if EXPR         Initialize and load only if EXPR evaluates to a non-nil value.\n:disabled        The package is ignored completely if this keyword is present.\n:defines         Declare certain variables to silence the byte-compiler.\n:functions       Declare certain functions to silence the byte-compiler.\n:load-path       Add to the `load-path' before attempting to load the package.\n:diminish        Support for diminish.el (if installed).\n:delight         Support for delight.el (if installed).\n:custom          Call `custom-set' or `set-default' with each variable\n                 definition without modifying the Emacs `custom-file'.\n                 (compare with `custom-set-variables').\n:custom-face     Call `customize-set-faces' with each face definition.\n:ensure          Loads the package using package.el if necessary.\n:pin             Pin the package to an archive." #<bytecode 0x11a08cd94a6b7ebb>)(indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i"))
  macroexpand((use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")) nil)
  macroexp-macroexpand((use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")) nil)
  macroexp--expand-all((use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")))
  macroexp--all-forms((lambda nil (message "### spacemacs-editing-visual/init-indent-guide %s" use-package-keywords) (use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i"))) 2)
  macroexp--expand-all(#'(lambda nil (message "### spacemacs-editing-visual/init-indent-guide %s" use-package-keywords) (use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i"))))
  macroexp--all-forms((defalias 'spacemacs-editing-visual/init-indent-guide #'(lambda nil (message "### spacemacs-editing-visual/init-indent-guide %s" use-package-keywords) (use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")))) 1)
  #f(compiled-function (form func) #<bytecode 0x3004488d6ece65b>)(((defalias 'spacemacs-editing-visual/init-indent-guide #'(lambda nil (message "### spacemacs-editing-visual/init-indent-guide %s" use-package-keywords) (use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i"))))) defalias)
  macroexp--expand-all((defalias 'spacemacs-editing-visual/init-indent-guide #'(lambda nil (message "### spacemacs-editing-visual/init-indent-guide %s" use-package-keywords) (use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")))))
  macroexpand-all((defalias 'spacemacs-editing-visual/init-indent-guide #'(lambda nil (message "### spacemacs-editing-visual/init-indent-guide %s" use-package-keywords) (use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")))))
  internal-macroexpand-for-load((defalias 'spacemacs-editing-visual/init-indent-guide #'(lambda nil (message "### spacemacs-editing-visual/init-indent-guide %s" use-package-keywords) (use-package indent-guide :defer t :custom (indent-guide-delay 0.3) :init (progn (spacemacs|add-toggle indent-guide :mode indent-guide-mode :documentation "Highlight indentation level at point. (alternative..." :evil-leader "ti") (spacemacs|add-toggle indent-guide-globally :mode indent-guide-global-mode :documentation "Highlight indentation level at point globally. (al..." :evil-leader "t TAB")) :spacediminish (" ⓘ" " i")))) t)
  eval-buffer(#<buffer  *load*-393740> nil "/home/kimr/.emacs.d/sm-ms/layers/+spacemacs/spacem..." nil t)  ; Reading at buffer position 6366
  load-with-code-conversion("/home/kimr/.emacs.d/sm-ms/layers/+spacemacs/spacem..." "/home/kimr/.emacs.d/sm-ms/layers/+spacemacs/spacem..." nil nil)
  load("/home/kimr/.emacs.d/sm-ms/layers/+spacemacs/spacem..." nil nil)
  configuration-layer/load-file("/home/kimr/.emacs.d/sm-ms/layers/+spacemacs/spacemacs-editing-visual/packages.el")
  (progn (configuration-layer/load-file packages-file) (symbol-value (intern (format "%S-packages" layer-name))))
  (if (and (null packages) (or usedp configuration-layer--load-packages-files) packages-file) (progn (configuration-layer/load-file packages-file) (symbol-value (intern (format "%S-packages" layer-name)))))
  (let* ((dir (file-name-as-directory dir)) (disabled (if (listp layer-specs) (progn (spacemacs/mplist-get-values layer-specs :disabled-for)))) (enabled (if (and (listp layer-specs) (memq :enabled-for layer-specs)) (spacemacs/mplist-get-values layer-specs :enabled-for) 'unspecified)) (variables (if (listp layer-specs) (progn (spacemacs/mplist-get-values layer-specs :variables)))) (shadow (if (and (listp layer-specs) (memq :can-shadow layer-specs)) (spacemacs/mplist-get-values layer-specs :can-shadow) 'unspecified)) (packages-file (locate-file "packages" (list dir) load-suffixes)) (packages (if (and (null packages) (or usedp configuration-layer--load-packages-files) packages-file) (progn (configuration-layer/load-file packages-file) (symbol-value (intern (format "%S-packages" layer-name)))))) (selected-packages (if packages (configuration-layer//select-packages layer-specs packages) 'all))) (eieio-oset obj ':dir dir) (if usedp (progn (eieio-oset obj ':disabled-for disabled) (eieio-oset obj ':enabled-for enabled) (eieio-oset obj ':variables variables) (if (eq 'unspecified shadow) nil (eieio-oset obj ':can-shadow shadow)))) (if packages (progn (eieio-oset obj ':packages packages) (eieio-oset obj ':selected-packages selected-packages))) obj)
  (if (or (null dir) (and dir (not (file-exists-p dir)))) (configuration-layer//warning "Cannot make layer %S without a valid directory!" layer-name) (let* ((dir (file-name-as-directory dir)) (disabled (if (listp layer-specs) (progn (spacemacs/mplist-get-values layer-specs :disabled-for)))) (enabled (if (and (listp layer-specs) (memq :enabled-for layer-specs)) (spacemacs/mplist-get-values layer-specs :enabled-for) 'unspecified)) (variables (if (listp layer-specs) (progn (spacemacs/mplist-get-values layer-specs :variables)))) (shadow (if (and (listp layer-specs) (memq :can-shadow layer-specs)) (spacemacs/mplist-get-values layer-specs :can-shadow) 'unspecified)) (packages-file (locate-file "packages" (list dir) load-suffixes)) (packages (if (and (null packages) (or usedp configuration-layer--load-packages-files) packages-file) (progn (configuration-layer/load-file packages-file) (symbol-value (intern ...))))) (selected-packages (if packages (configuration-layer//select-packages layer-specs packages) 'all))) (eieio-oset obj ':dir dir) (if usedp (progn (eieio-oset obj ':disabled-for disabled) (eieio-oset obj ':enabled-for enabled) (eieio-oset obj ':variables variables) (if (eq 'unspecified shadow) nil (eieio-oset obj ':can-shadow shadow)))) (if packages (progn (eieio-oset obj ':packages packages) (eieio-oset obj ':selected-packages selected-packages))) obj))
  (let* ((layer-name (if (listp layer-specs) (car layer-specs) layer-specs)) (obj (if obj obj (cfgl-layer (symbol-name layer-name) :name layer-name))) (packages (eieio-oref obj ':packages)) (dir (or dir (eieio-oref obj ':dir)))) (if (or (null dir) (and dir (not (file-exists-p dir)))) (configuration-layer//warning "Cannot make layer %S without a valid directory!" layer-name) (let* ((dir (file-name-as-directory dir)) (disabled (if (listp layer-specs) (progn (spacemacs/mplist-get-values layer-specs :disabled-for)))) (enabled (if (and (listp layer-specs) (memq :enabled-for layer-specs)) (spacemacs/mplist-get-values layer-specs :enabled-for) 'unspecified)) (variables (if (listp layer-specs) (progn (spacemacs/mplist-get-values layer-specs :variables)))) (shadow (if (and (listp layer-specs) (memq :can-shadow layer-specs)) (spacemacs/mplist-get-values layer-specs :can-shadow) 'unspecified)) (packages-file (locate-file "packages" (list dir) load-suffixes)) (packages (if (and (null packages) (or usedp configuration-layer--load-packages-files) packages-file) (progn (configuration-layer/load-file packages-file) (symbol-value ...)))) (selected-packages (if packages (configuration-layer//select-packages layer-specs packages) 'all))) (eieio-oset obj ':dir dir) (if usedp (progn (eieio-oset obj ':disabled-for disabled) (eieio-oset obj ':enabled-for enabled) (eieio-oset obj ':variables variables) (if (eq 'unspecified shadow) nil (eieio-oset obj ':can-shadow shadow)))) (if packages (progn (eieio-oset obj ':packages packages) (eieio-oset obj ':selected-packages selected-packages))) obj)))
  configuration-layer/make-layer(spacemacs-editing-visual #<cfgl-layer cfgl-layer-15653fa949e8> t)
  (let ((obj (configuration-layer/make-layer layer-specs (configuration-layer/get-layer layer-name) usedp))) (configuration-layer//add-layer obj usedp) (configuration-layer//set-layer-variables obj) (if (and (not skip-layer-deps) (not (eieio-oref layer ':deps-loaded)) (or usedp configuration-layer--load-packages-files)) (progn (eieio-oset layer ':deps-loaded t) (configuration-layer//load-layer-files layer-name '("layers")))))
  (if layer (let ((obj (configuration-layer/make-layer layer-specs (configuration-layer/get-layer layer-name) usedp))) (configuration-layer//add-layer obj usedp) (configuration-layer//set-layer-variables obj) (if (and (not skip-layer-deps) (not (eieio-oref layer ':deps-loaded)) (or usedp configuration-layer--load-packages-files)) (progn (eieio-oset layer ':deps-loaded t) (configuration-layer//load-layer-files layer-name '("layers"))))) (configuration-layer//warning "Unknown declared layer %s." layer-name))
  (let* ((layer-name (if (listp layer-specs) (car layer-specs) layer-specs)) (layer (configuration-layer/get-layer layer-name)) (usedp configuration-layer--declared-layers-usedp)) (if layer (let ((obj (configuration-layer/make-layer layer-specs (configuration-layer/get-layer layer-name) usedp))) (configuration-layer//add-layer obj usedp) (configuration-layer//set-layer-variables obj) (if (and (not skip-layer-deps) (not (eieio-oref layer ':deps-loaded)) (or usedp configuration-layer--load-packages-files)) (progn (eieio-oset layer ':deps-loaded t) (configuration-layer//load-layer-files layer-name '("layers"))))) (configuration-layer//warning "Unknown declared layer %s." layer-name)))
  configuration-layer/declare-layer(spacemacs-editing-visual nil)
  (while --dolist-tail-- (setq specs (car --dolist-tail--)) (configuration-layer/declare-layer specs skip-layer-deps) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (let ((--dolist-tail-- layers-specs) specs) (while --dolist-tail-- (setq specs (car --dolist-tail--)) (configuration-layer/declare-layer specs skip-layer-deps) (setq --dolist-tail-- (cdr --dolist-tail--))))
  configuration-layer/declare-layers((helm treemacs spacemacs-base spacemacs-completion spacemacs-layouts spacemacs-editing spacemacs-editing-visual spacemacs-evil spacemacs-language spacemacs-misc spacemacs-modeline spacemacs-navigation spacemacs-org spacemacs-project spacemacs-purpose spacemacs-visual))
  eval-buffer(#<buffer  *load*-569611> nil "/home/kimr/.emacs.d/sm-ms/layers/+distributions/sp..." nil t)  ; Reading at buffer position 1476
  load-with-code-conversion("/home/kimr/.emacs.d/sm-ms/layers/+distributions/sp..." "/home/kimr/.emacs.d/sm-ms/layers/+distributions/sp..." t nil)
  load("/home/kimr/.emacs.d/sm-ms/layers/+distributions/sp..." t nil)
  configuration-layer/load-file("/home/kimr/.emacs.d/sm-ms/layers/+distributions/sp..." t)
  (let ((file (concat (eieio-oref obj ':dir) file))) (configuration-layer/load-file file t))
  (while --dolist-tail-- (setq file (car --dolist-tail--)) (let ((file (concat (eieio-oref obj ':dir) file))) (configuration-layer/load-file file t)) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (let ((--dolist-tail-- files) file) (while --dolist-tail-- (setq file (car --dolist-tail--)) (let ((file (concat (eieio-oref obj ':dir) file))) (configuration-layer/load-file file t)) (setq --dolist-tail-- (cdr --dolist-tail--))))
  (progn (let ((--dolist-tail-- files) file) (while --dolist-tail-- (setq file (car --dolist-tail--)) (let ((file (concat (eieio-oref obj ...) file))) (configuration-layer/load-file file t)) (setq --dolist-tail-- (cdr --dolist-tail--)))))
  (if obj (progn (let ((--dolist-tail-- files) file) (while --dolist-tail-- (setq file (car --dolist-tail--)) (let ((file (concat ... file))) (configuration-layer/load-file file t)) (setq --dolist-tail-- (cdr --dolist-tail--))))))
  (let ((obj (configuration-layer/get-layer layer-name))) (if obj (progn (let ((--dolist-tail-- files) file) (while --dolist-tail-- (setq file (car --dolist-tail--)) (let ((file ...)) (configuration-layer/load-file file t)) (setq --dolist-tail-- (cdr --dolist-tail--)))))))
  configuration-layer//load-layer-files(spacemacs ("layers"))
  (progn (eieio-oset layer ':deps-loaded t) (configuration-layer//load-layer-files layer-name '("layers")))
  (if (and (not skip-layer-deps) (not (eieio-oref layer ':deps-loaded)) (or usedp configuration-layer--load-packages-files)) (progn (eieio-oset layer ':deps-loaded t) (configuration-layer//load-layer-files layer-name '("layers"))))
  (let ((obj (configuration-layer/make-layer layer-specs (configuration-layer/get-layer layer-name) usedp))) (configuration-layer//add-layer obj usedp) (configuration-layer//set-layer-variables obj) (if (and (not skip-layer-deps) (not (eieio-oref layer ':deps-loaded)) (or usedp configuration-layer--load-packages-files)) (progn (eieio-oset layer ':deps-loaded t) (configuration-layer//load-layer-files layer-name '("layers")))))
  (if layer (let ((obj (configuration-layer/make-layer layer-specs (configuration-layer/get-layer layer-name) usedp))) (configuration-layer//add-layer obj usedp) (configuration-layer//set-layer-variables obj) (if (and (not skip-layer-deps) (not (eieio-oref layer ':deps-loaded)) (or usedp configuration-layer--load-packages-files)) (progn (eieio-oset layer ':deps-loaded t) (configuration-layer//load-layer-files layer-name '("layers"))))) (configuration-layer//warning "Unknown declared layer %s." layer-name))
  (let* ((layer-name (if (listp layer-specs) (car layer-specs) layer-specs)) (layer (configuration-layer/get-layer layer-name)) (usedp configuration-layer--declared-layers-usedp)) (if layer (let ((obj (configuration-layer/make-layer layer-specs (configuration-layer/get-layer layer-name) usedp))) (configuration-layer//add-layer obj usedp) (configuration-layer//set-layer-variables obj) (if (and (not skip-layer-deps) (not (eieio-oref layer ':deps-loaded)) (or usedp configuration-layer--load-packages-files)) (progn (eieio-oset layer ':deps-loaded t) (configuration-layer//load-layer-files layer-name '("layers"))))) (configuration-layer//warning "Unknown declared layer %s." layer-name)))
  configuration-layer/declare-layer(spacemacs)
  (if (eq 'spacemacs-bootstrap distribution) nil (configuration-layer/declare-layer distribution))
  (let ((distribution (if configuration-layer-force-distribution configuration-layer-force-distribution dotspacemacs-distribution))) (if (eq 'spacemacs-bootstrap distribution) nil (configuration-layer/declare-layer distribution)))
  (let ((configuration-layer--declared-layers-usedp t)) (if configuration-layer-exclude-all-layers nil (let ((--dolist-tail-- (remove nil layers-specs)) layer-specs) (while --dolist-tail-- (setq layer-specs (car --dolist-tail--)) (let* ((layer-name (if ... ... layer-specs)) (layer (configuration-layer/get-layer layer-name))) (if layer (let (...) (if ... nil ...)) (configuration-layer//warning "Unknown layer %s declared in dotfile." layer-name))) (setq --dolist-tail-- (cdr --dolist-tail--)))) (setq configuration-layer--used-layers (reverse configuration-layer--used-layers))) (let ((--dolist-tail-- configuration-layer--layers-dependencies) layer-name) (while --dolist-tail-- (setq layer-name (car --dolist-tail--)) (configuration-layer/declare-layer layer-name) (setq --dolist-tail-- (cdr --dolist-tail--)))) (let ((distribution (if configuration-layer-force-distribution configuration-layer-force-distribution dotspacemacs-distribution))) (if (eq 'spacemacs-bootstrap distribution) nil (configuration-layer/declare-layer distribution))) (configuration-layer/declare-layer 'spacemacs-bootstrap))
  configuration-layer//declare-used-layers(((auto-completion :variables auto-completion-tab-key-behavior 'cycle auto-completion-complete-with-key-sequence nil auto-completion-enable-help-tooltip t auto-completion-enable-sort-by-usage t) (c-c++ :variables c-c++-adopt-subprojects t c-c++-backend 'lsp-ccls c-c++-default-mode-for-headers 'c++-mode c-c++-enable-c++11 t c-c++-enable-clang-support t c-c++-lsp-cquery-cache-directory "/home/kimr/.cache/lsp-ccls" c-c++-lsp-sem-highlight-rainbow t) command-log dap (dash :variables helm-dash-docsets-path "/u/kimr/public_html/docsets") (elfeed) emacs-lisp eos (git :variables git-magit-status-fullscreen nil) html helm (lsp :variables lsp-keymap-prefix "C-;" lsp-remap-xref-keybindings t lsp-ui-sideline-show-hover t lsp-enable-file-watchers nil) markdown (org :variables org-directory (expand-file-name "~/org") org-enable-github-support t org-enable-reveal-js-support t org-enable-jira-support t org-enable-roam-support t org-enable-roam-protocol t org-enable-transclusion-support t org-roam-v2-ack t org-roam-directory org-directory org-roam-completion-everywhere t org-roam-mode-section-functions (list #'org-roam-backlinks-section #'org-roam-reflinks-section) org-enable-valign nil) pandoc pdf perforce (python :variables python-backend 'lsp python-lsp-server 'pylsp python-test-runner '(pytest nose) python-formatter 'lsp python-format-on-save t python-save-before-test nil python-fill-column 99 python-sort-imports-on-save t) (shell :variables) shell-scripts spell-checking sql syntax-checking (treemacs :variables treemacs-use-follow-mode 'tag) (version-control :variables version-control-diff-tool 'diff-hl) yaml))
  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 configu..." "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 p...")) (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 ((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 ((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))))))
  eval-buffer(#<buffer  *load*-313629> nil "/home/kimr/.emacs.d/sm-ms/init.el" nil t)  ; Reading at buffer position 3374
  load-with-code-conversion("/home/kimr/.emacs.d/sm-ms/init.el" "/home/kimr/.emacs.d/sm-ms/init.el" t t)
  load("/home/kimr/.emacs.d/sm-ms/init.el" t t)
  (let ((init-file (expand-file-name "init.el" user-emacs-directory))) (setq package-user-dir (expand-file-name "elpa" user-emacs-directory)) (load init-file t t) (let ((chemacs-custom-file (chemacs-profile-get 'custom-file init-file))) (if (not custom-file) (progn (setq custom-file chemacs-custom-file) (if (equal custom-file init-file) nil (if (file-exists-p custom-file) nil (let (...) (save-current-buffer ... ...))) (load custom-file))))))
  chemacs-load-user-init()
  eval-buffer(#<buffer  *load*> nil "/home/kimr/.emacs.d/init.el" nil t)  ; Reading at buffer position 238
  load-with-code-conversion("/home/kimr/.emacs.d/init.el" "/home/kimr/.emacs.d/init.el" t t)
  load("/home/kimr/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x10f60915e0a615f6>) #f(compiled-function () #<bytecode -0x1f3c686ddc0cc375>) t)
  command-line()
 normal-top-level()
emacs18 commented 2 years ago

I use straight.el to install packages rather than package.el. I don't know whether this matters, but I thought it might be relevant information to share.

mheister commented 2 years ago

This seems to be happening when a version of use-package.el is loaded before spacemacs initializes. For me it happens with emacs-ng which made use-package.el a built-in package. @emacs18 I think for you it's because you load spacemacs through use chemacs.

Looking at @emacs18's and my backtraces, it seems that the error happens during eager-macro-expansion when the package.el files of the layers are loaded, which is before the evaluation of the init functions. Hence the :spacediminish keyword is not yet added to use-package-keywords then. If the eager-macro-expansion has a definition of the use-package macro, it will try to expand it, producing the error. Otherwise it will just pass over it.

There are efforts to put use-package into upstream emacs. I am not sure that this would mean that the macro would be auto-loaded. If it does, this issue could affect more people in the future.

A workaround could be to simply

(fmakunbound 'use-package)

at the beginning of spacemacs' init.el file (or somewhere before (configuration-layer/load)).

Alternatively, one could prevent eager expansion during the loading of package.el files. Stackexchange user philis describes a way to temporarily disable it here. It could look something like this, in core/core-configuration-layer.el:

(defun configuration-layer/make-layer (layer-specs &optional obj usedp dir)
;; [...]
;; instead of
;;                          (configuration-layer/load-file packages-file)
;; put
                         (configuration-layer/load-file-without-eager-macroexp packages-file)
;; [...]
)

;; add this defun
(defun configuration-layer/load-file-without-eager-macroexp (file &optional noerror)
  "Load file silently except if in debug mode and prevent
eager-macro-expansion while loading"
  (cl-letf (((symbol-function 'internal-macroexpand-for-load) nil))
    (fmakunbound 'internal-macroexpand-for-load)
    (configuration-layer/load-file file noerror)))

I am not sure whether either solution would be desirable in spacemacs but I'd be happy to create a PR.

My backtrace: backtrace.log

agenbite commented 1 year ago

FWIW, after an update I have found this same problem, and solved it with the init.el workaround proposed by @mheister. I'm unclear as to the sustainability of this solution, but, if it's ok, it'd be nice to have it integrated in the codebase.

emacs18 commented 1 year ago

use-package is now built into emacs. See for example https://irreal.org/blog/?p=11003

Thus the problem of :spacediminish being used before it is defined is more acute problem. In fact I had to remove more uses of :spacediminish recently from spacemacs in order to avoid startup problems on emacs 29.

If I were to submit a PR that removes all uses of :spacediminish would that be acceptable? Someone can then put it back once we can make sure that it is safe to use them.

catesandrew commented 1 year ago

I also applied the patch from @mheister after recent install of emacs-plus@29. Was getting lots of errors and this fixed it. Then since I was using 29 I backed out the fix from core/core-configuration-layer.el and used (fmakunbound 'use-package) at top of init.el instead. Both worked for me but I prefer the fmakunbound method.

mheister commented 1 year ago

The issue is resolved for me after b28d65b7aa7a936cdab7fc0453df86b21ac1496f. Thank you, @smile13241324 :thumbsup:

jumarko commented 1 year ago

Thanks, this helped me to resolve my issues when running Emacs 29 too!

vxe commented 1 year ago

on a fresh install of emacs-plus 29 for macos, i put (fmakunbound 'use-package) ~/.spacemacs.d/init.el under the dotspacemacs/user-init then deleted all of ~/.emacs.d/elpa/29.1/develop and that seemed to get it to work