I have this function in config
(defun launch-separate-emacs-under-x ()
(interactive)
(call-process "sh" nil nil nil "-c" "emacs &"))
(defun restart-emacs ()
(interactive)
(add-hook 'kill-emacs-hook
(if (display-graphic-p)
#'launch-separate-emacs-under-x
#'launch-separate-emacs-in-terminal)
t)
(kill-emacs))
Update:
In general if i execute any command say package-install
it will be added to command history. But when I execute above function using M-x
, it is not getting added into commands history. How to make emacs to add this command to history?
helm-M-x
, I guess settinghelm-M-x-always-save-history
to t can save that history.launch-separate-emacs-*
. And you didn't say where you invoke this command from, I should just assume the built-inM-x
. Does other commands works as you expected? AFAIK ,extended-command-history
is usually used to keep command history and thesavehist
package can save various minibuffer input history across Emacs session.kill-emacs
directly. Runkill-emacs
on a 0 second timer so that the stack can clear and the command might then be added to the history.