iqbalansari / restart-emacs

A simple emacs package to restart emacs from within emacs
GNU General Public License v3.0
154 stars 14 forks source link

Does it work on Windows? #9

Closed seagle0128 closed 7 years ago

seagle0128 commented 7 years ago

I am using GNU Emacs 25.1 on Windows 7. restart-emacs doesn't restart actually.

GNU Emacs x64: https://sourceforge.net/projects/emacsbinw64/files/release/ (emacs-w64-25.1-O2-with-modules.7z)

My configuration is

(require 'restart-emacs)
(setq restart-emacs-restore-frames t)

I execute runemacs.exe to start Emacs.

iqbalansari commented 7 years ago

Yes it should work on Windows, in fact last time I checked it worked. Unfortunately I do not currently have access to a Windows machine right now. Does setting restart-emacs-restore-frames to nil fix this?

seagle0128 commented 7 years ago

Nop, it doesn't work...

iqbalansari commented 7 years ago

Oh, thanks for the quick feedback. Let me see if I can get hold of a Windows machine to debug this

seagle0128 commented 7 years ago

Thanks, @iqbalansari . BTW, I enabled desktop-save-mode.

iqbalansari commented 7 years ago

I got some chance to test on Windows, it seems that standalone instances of Emacs restart (and frames are restored) but it fails for Emacs started in daemon mode. Is that correct?

seagle0128 commented 7 years ago

I don't understand what's exact meaning of daemon mode. I am running GNU Emacs x64 GUI on Windows 7, and enable enable-save-mode and server-mode. Do you mean server-mode is daemon mode?

I did some research here.

  1. run runemacs.exe, disable server-mode, and restart-emacs. [FAIL]
  2. run runemacs.exe, enable server-mode, and restart-emacs. [FAIL]
  3. run emacs.exe, disable server-mode, and restart-emacs. [OK]
  4. run emacs.exe, enable server-mode, and restart-emacs. [FAIL]

I prefer runemacs.exe. Hope it's helpful.

iqbalansari commented 7 years ago

I don't understand what's exact meaning of daemon mode.

Daemon mode is when you start Emacs with --daemon flag, it is same as server-mode except that no initial frame is created, you can edit files using Emacsclient.

The research you did is certainly helpful, thanks a lot, however it is working for me for all the above combinations you posted. My Emacs configuration is very minimal

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))

(package-initialize)

(unless (package-installed-p 'restart-emacs)
  (package-refresh-contents)
  (package-install 'restart-emacs))

(setq restart-emacs-restore-frames t)
(ido-mode +1)
(desktop-save-mode)

Could it be that something in you Emacs configuration is causing issues? Could you try using restart-emacs with minimal configuration? Alternatively can you share you Emacs configuration or try with the above configuration to see if issue still occurs?

Thanks for your patience

seagle0128 commented 7 years ago

Thanks for your quick and detailed reply! I will update the results once I complete. BTW, you can find my Emacs configurations here https://github.com/seagle0128/.emacs.d. Maybe you can point out the root cause as well.

iqbalansari commented 7 years ago

I just tried your configuration and restart and restoring frames worked flawlessly with and without server mode with both runemacs.exe and emacs.exe. Once you get to try the minimal configuration I posted above could you also try disabling desktop-save-mode (in your configuration) and see if it works?

seagle0128 commented 7 years ago

@iqbalansari I used minimal configuration and my configuration to test. I found some clues. restart-emacs doesn't work with spu package (https://github.com/mola-T/spu). If disable spu, it works well.

iqbalansari commented 7 years ago

Great news, I will try to debug further today. What is strange is that your configuration worked any issues on my side (I am assuming you have spu enabled by default)

seagle0128 commented 7 years ago

Yes, it's enabled by default. My spu configuration is below.

;; Silent package upgrader
(use-package spu
  :defer 10 ;; defer package loading for 10 seconds
  :config (spu-package-upgrade-daily))

Anyway, I use auto-package-update instead of spu and it works well now.

iqbalansari commented 7 years ago

@seagle0128 I got some time to debug this, it seems that timp the package used by spu breaks restart-emacs, I have opened an issue on timp repository. Until timp's bug is fixed, I am pushing a temporary fix for this issue.

seagle0128 commented 7 years ago

@iqbalansari Thanks very much! The fixing works well. I'd like close it for now.

iqbalansari commented 7 years ago

Thanks for the confirmation @seagle0128 although it seems that the fix I pushed yesterday is not foolproof, I guess I will wait for timp's maintainer to respond