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

timp--kill-emacs ignores dynamically bound kill-emacs-hook #6

Open
iqbalansari opened this issue Mar 13, 2017 · 0 comments
Open

timp--kill-emacs ignores dynamically bound kill-emacs-hook #6

iqbalansari opened this issue Mar 13, 2017 · 0 comments

Comments

@iqbalansari
Copy link

Hi,

I am the author of the package restart-emacs.

One of the package's user hit a bug. After some debugging it seems that issue is with the advice timp--kill-emacs that timp adds around save-buffers-kill-emacs function.

The restart-emacs package works by starting a new instance of Emacs just before current instance of Emacs is killed, to achieve this a function is added to the kill-emacs-hook which actually starts the new instance.

Obviously the function needs to be added temporarily to kill-emacs-hook, so that it does not interfere with normal Emacs exists. The easiest way to do this is to create a let binding for kill-emacs-hook around the invocation of function save-buffers-kill-emacs, which contains the function that needs to be invoked for launching other Emacs. This way the hook is present only for that invocation and no code is needed to remove it if Emacs exit fails for some reason. I am not sure if I have explained the restart process well enough, let me know if it was not clear.

Now since timp--kill-emacs invokes the function asynchronously (if some thread is running and needs to be stopped) using a timer the dynamic environment setup with the special value of kill-emacs-hook described above is lost and restarting fails.

Perhaps making the wait synchronous would solve the issue, something like the following

(dotimes (x 5)
    (message "Waiting ... %d seconds left" (- 5 x))
    (sit-for 1))

Thanks

iqbalansari added a commit to iqbalansari/restart-emacs that referenced this issue Mar 13, 2017
This is a temporary fix for #9, until the upstream bug is fixed.

See mola-T/timp#6
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

1 participant