From fd342dfdb04a43db8395e1d1e68c7b804760be9c Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 3 May 2020 19:49:18 -0400 Subject: [PATCH] Fix #2982: multiple instances of Emacs on restart When invoking a restart during a restart (Yo dawg...) --- core/autoload/sessions.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/autoload/sessions.el b/core/autoload/sessions.el index 0d2833802..de08be93d 100644 --- a/core/autoload/sessions.el +++ b/core/autoload/sessions.el @@ -130,8 +130,11 @@ (interactive "P") (setq doom-autosave-session nil) (doom/quicksave-session) - (restart-emacs - (append (if debug (list "--debug-init")) - (when (boundp 'chemacs-current-emacs-profile) - (list "--with-profile" chemacs-current-emacs-profile)) - (list "--restore")))) + (save-some-buffers nil t) + (letf! ((#'save-buffers-kill-emacs #'kill-emacs) + (confirm-kill-emacs)) + (restart-emacs + (append (if debug (list "--debug-init")) + (when (boundp 'chemacs-current-emacs-profile) + (list "--with-profile" chemacs-current-emacs-profile)) + (list "--restore")))))