Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a "Spacemacs/restart" function results in a wrong number of arguments error (Emacs 29.1) #16185

Closed
ViktorHaag opened this issue Nov 8, 2023 · 5 comments

Comments

@ViktorHaag
Copy link

ViktorHaag commented Nov 8, 2023

Description :octocat:

Using one of the "spacemacs/restart" calls results in a "wrong number of
arguemnts (0.0), 1" error.

Reproduction guide 🪲

  • Start Emacs 29
  • Use "M-m q r" to quit

Observed behaviour: 👀 💔

  • Quitting using one of the "spacemacs/restart-" functions does not quit, but
    throws the wrong number of arguments error.

It appears that spacemacs is attempting to pass a "--resume-layouts" argument
down into the Emacs fundamental "restart-emacs" method, which in 29.1 seems to
be a method that does not take any parameters.

This seems like a core bug.

I have tried doing this from a fresh install of both Emacs and Spacemacs and the error occurs.

I believe that this commit here might be involved: 91f6b2d (see PR #16178).

Reverting that change seems to fix the issue.

Expected behaviour: ❤️ 😄
Emacs should restart

System Info 💻

  • OS: darwin
  • Emacs: 29.1
  • Spacemacs: 0.999.0
  • Spacemacs branch: old-local-python-mode (rev. 8d3fb17) (Personal fork)
  • Graphic display: t
  • Running in daemon: nil
  • Distribution: spacemacs
  • Editing style: emacs
  • Completion: (compleseus denote-personal emacs-lisp git html ibuffer-personal javascript local-functions markdown multiple-cursors org osx python-personal restructuredtext syntax-checking tern theming treemacs yaml)
  • Layers:
(compleseus denote-personal emacs-lisp git html ibuffer-personal
            (javascript :variables js-switch-indent-offset 4)
            local-functions markdown multiple-cursors
            (org :variables org-enable-github-support t org-enable-org-journal-support t)
            (osx :variables osx-command-as 'meta osx-option-as 'super osx-control-as 'control osx-function-as nil)
            python-personal restructuredtext syntax-checking tern theming
            (treemacs :variables treemacs-use-icons-dired nil)
            yaml)
  • System configuration features: ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE PDUMPER SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER XWIDGETS ZLIB

Backtrace 🐾

Debugger entered--Lisp error: (wrong-number-of-arguments (0 . 0) 1)
  restart-emacs(("--resume-layouts"))
  spacemacs/restart-emacs(("--resume-layouts"))
  spacemacs/restart-emacs-resume-layouts()
  funcall-interactively(spacemacs/restart-emacs-resume-layouts)
  call-interactively(spacemacs/restart-emacs-resume-layouts nil nil)
  command-execute(spacemacs/restart-emacs-resume-layouts)

@ViktorHaag
Copy link
Author

I notice that this open issue on restart-emacs suggests the source of the problem is a function naming collision with a core Emacs function introduced with Emacs 29.

I wonder if the suggestion in that issue of requiring files as a dependency of loading restart-emacs is expedient here? So, instead of

defun spacemacs-navigation/init-restart-emacs ()
  (use-package restart-emacs
    ;; :after files ;; this was what we had before the recent commit
    :defer (spacemacs/defer)
    :init
    (spacemacs/set-leader-keys
...

we could instead have

defun spacemacs-navigation/init-restart-emacs ()
  (use-package restart-emacs
    :require files
    ;; :defer (spacemacs/defer) ;; was switched to defer in recent commit
    :init
    (spacemacs/set-leader-keys
...

A quick test of this code-change locally seems like it would work, but I'm no expert about package loading complexities nor am I set up to do thorough testing of changes to spacemacs.

ViktorHaag added a commit to ViktorHaag/spacemacs that referenced this issue Nov 8, 2023
- Recent PR change ":after files" with deferred loading which doesn't seem to
determinably solve the problem with Emacs 29 of restart-emacs/restart-emacs
colliding with files/restart-emacs (introduced with Emacs 29 with fewer args).

- Switch to ":require files" to ensure it's loaded before the restart-emacs
package, so the restart-emacs/restart-emacs function ovewrites the core function
and not the other way around.

- May be REVERTABLE depending on how upstream copes with this change.

See also: syl20bnr#16185
@sunlin7
Copy link
Contributor

sunlin7 commented Nov 9, 2023

The PR #16186 should fix the issue.

@ViktorHaag
Copy link
Author

The PR #16186 should fix the issue.

Thank you very much!

@ViktorHaag
Copy link
Author

The PR does seem to address this issue, so I'm comfortable closing.

@sunlin7
Copy link
Contributor

sunlin7 commented Nov 9, 2023

Thanks for your confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants