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

Restart fails #15505

Closed
agenbite opened this issue May 10, 2022 · 18 comments
Closed

Restart fails #15505

agenbite opened this issue May 10, 2022 · 18 comments
Assignees

Comments

@agenbite
Copy link

Description :octocat:

Restart with layout resume fails

Reproduction guide 🪲

  • Start Emacs
  • Hit SPC q r

Observed behaviour: 👀 💔
The following error appears: "spacemacs/restart-emacs: Wrong number of arguments: restart-emacs, 1"

Expected behaviour: ❤️ 😄
Spacemacs should restart and restore layouts.

The problem is that spacemacs/restart-emacs tries to pass an argument to restart-emacs, which does not accept any arguments.

System Info 💻

  • OS: gnu/linux
  • Emacs: 29.0.50
  • Spacemacs: 0.999.0
  • Spacemacs branch: develop (rev. c6c1774)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: selectrum
  • Layers:
(csv python go org notmuch evil-snipe
     (evil-snipe :variables evil-snipe-enable-alternate-f-and-t-behaviors t evil-snipe-override-mode t)
     latex bibtex git pdf emacs-lisp compleseus
     (compleseus :variables compleseus-engine 'selectrum)
     ranger)
  • System configuration features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS XIM GTK3 ZLIB
@practicalli-johnny
Copy link
Contributor

practicalli-johnny commented May 11, 2022

I cannot replicate this issue on Emacs 28.1 on gnu/linux

  • SPC q r restarts emacs and loads existing layouts
  • SPC q R restarts emacs and loads existing layouts too...

Spacemacs seems to be using the restart-emacs package which includes a function called restart-emacs that takes optional arguments
https://github.com/iqbalansari/restart-emacs/blob/master/restart-emacs.el#L396

Searching through the code of Spacemacs 0.999 (latest develop commit) the restart-emacs function definition is found in ~/.config/emacs/elpa/28.1/develop/restart-emacs-20201127.1425/restart-emacs.el

Has Emacs 29.0.50 introduced its own restart-emacs function?

EDIT: yes, it seems Emacs 29 has its own restart-emacs function

@agenbite
Copy link
Author

I'm a total noob in emacs development, but apparently 3 weeks ago there was a commit series related to restart-emacs (starting in 5be9a9cacf). I'll try to dig a bit deeper in that place.

@drewverlee
Copy link

I can replicate this. Here is the output from emacs version:

GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-05-06

Where would i look to remove the .elc file?

@BenedictHW
Copy link
Contributor

BenedictHW commented May 12, 2022

/home/$USER/.emacs.d/elpa/29.0/develop/restart-emacs-20201127.1425/restart-emacs.elc

If only elisp had the proper namespacing similar to common lisp. Already reported upstream here:

iqbalansari/restart-emacs#23

@edwinclement08
Copy link

Facing the same issue. Thanks for the reporting

@dalanicolai
Copy link
Contributor

FYI, a simple quick-fix is to press SPC h SPC restart-emacs and replace the :defer t for :after files.

@agenbite
Copy link
Author

Thanks, @dalanicolai, that solves it for the moment.

@agenbite agenbite changed the title Restart with layout resume fails Restart fails May 18, 2022
@smile13241324 smile13241324 self-assigned this Jun 4, 2022
smile13241324 added a commit that referenced this issue Jun 11, 2022
This work around is taken from dalanicolai's comment on #15505.
It tries to circumvent a name clash between the emacs package
"restart-emacs" and emacs 29 which introduced a function called
"restart-emacs".

The workaround is to load the package after the emacs file
module has been loaded.
@smile13241324
Copy link
Collaborator

@agenbite Please have a try with latest develop and close this ticket when it works, thanks.

@magthe
Copy link
Contributor

magthe commented Jun 12, 2022

The change above, Try to fix name clash in emacs 29, doesn't fix things completely. What @dalanicolai suggests, and what I just confirmed works for me, is to replace :defer t with :after files. That is, what I did to make it work after the change above is

diff --git a/layers/+spacemacs/spacemacs-navigation/packages.el b/layers/+spacemacs/spacemacs-navigation/packages.el
index 075485405..4c04f1bb1 100644
--- a/layers/+spacemacs/spacemacs-navigation/packages.el
+++ b/layers/+spacemacs/spacemacs-navigation/packages.el
@@ -367,7 +367,6 @@
 
 (defun spacemacs-navigation/init-restart-emacs ()
   (use-package restart-emacs
-    :defer t
     :after files
     :init
     (spacemacs/set-leader-keys

magthe added a commit to magthe/spacemacs that referenced this issue Jun 12, 2022
The last piece of dalanicolai's suggestion in syl20bnr#15505 was missing from the
previous change. This change adds that step.
@dalanicolai
Copy link
Contributor

dalanicolai commented Jun 12, 2022

@smile13241324 @magthe I did not think about keeping, the defer, although that looks better indeed. However, apparently when a function with a name is already loaded, then the autoload for some other function with the same name does not seem to work (just tested it).

So indeed I think it really is necessary to remove the :defer t as in @magthe his PR (or 'fix' the autoload mechanism).

smile13241324 added a commit that referenced this issue Jun 12, 2022
We need to remove the defer keyword for this fix
to work.

See #15505 and #15524 for details.
@smile13241324
Copy link
Collaborator

Ahh crap :(, I have removed the defer keyword now, please give it another try. Maybe a better solution would be to not use this package at all when emacs 29 is available however I am not sure how stable the api already is and whether we would loose features there. Anyway this would be a good topic for a following PR if somebody wants to invest the time :). For now this fix would at least make it working again.

Can you have another go @magthe and confirm when its working? I am still stuck on emacs 28.1 without native compilation, need to change my IDE setup to build emacs from source again...

2ynn pushed a commit to 2ynn/spacemacs that referenced this issue Jun 22, 2022
This work around is taken from dalanicolai's comment on syl20bnr#15505.
It tries to circumvent a name clash between the emacs package
"restart-emacs" and emacs 29 which introduced a function called
"restart-emacs".

The workaround is to load the package after the emacs file
module has been loaded.
2ynn pushed a commit to 2ynn/spacemacs that referenced this issue Jun 22, 2022
We need to remove the defer keyword for this fix
to work.

See syl20bnr#15505 and syl20bnr#15524 for details.
@magthe
Copy link
Contributor

magthe commented Jun 28, 2022

It works fine now @smile13241324

@vitaminace33
Copy link
Contributor

Is anybody experiencing a bug regression?

@smile13241324
Copy link
Collaborator

@sunlin7 can you double check? This could be caused by lazy loading emacs restart.

@agenbite
Copy link
Author

agenbite commented Nov 8, 2023

I haven't experienced that issue since. Thanks for your work!

@sunlin7
Copy link
Contributor

sunlin7 commented Nov 8, 2023

Hi @agenbite
Please help verify the change in #16186 for the issue. I had verified on emacs-29.1.
Thanks

@vitaminace33
Copy link
Contributor

I updated this morning and SPC-m q r/SPC-m q R works just fine. Thx!

@sunlin7
Copy link
Contributor

sunlin7 commented Nov 10, 2023

Thanks for the information!

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

10 participants