* Restart Emacs

** Table of contents                                              :TOC_3_gh:
 - [[#restart-emacs][Restart Emacs]]
   - [[#what-is-this][What is this?]]
   - [[#installation][Installation]]
     - [[#elpa][ELPA]]
     - [[#el-get][El-get]]
   - [[#usage][Usage]]
   - [[#compatibility][Compatibility]]
     - [[#restarting-gui-emacs][Restarting GUI Emacs]]
     - [[#restarting-emacs-running-in-a-terminal][Restarting Emacs running in a terminal]]

** What is this?
   This is a simple package to restart Emacs for within Emacs. Inspired by [[http://emacs.stackexchange.com/questions/5428/restart-emacs-from-within-emacs][this]]
   stackoverflow question.

** Installation
*** ELPA
    ~restart-emacs~ is available on [[http://melpa.org/#/restart-emacs][MELPA]] and [[http://stable.melpa.org/#/restart-emacs][MELPA Stable]]. Please follow the instructions on
    MELPA [[http://melpa.org/#/getting-started][website]] to enable it, if you haven't already.

    You can then install ~restart-emacs~ from the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Menu.html][package menu]]. Alternatively install it by doing the following

    Refresh the package index
    #+BEGIN_QUOTE
    M-x package-refresh-contents RET
    #+END_QUOTE

    And then install it by doing
    #+BEGIN_QUOTE
    M-x package-install RET restart-emacs
    #+END_QUOTE

*** El-get
    ~restart-emacs~ can also be installed using ~el-get~. Assuming you have latest version of el-get installing it by doing something similar to
    #+BEGIN_QUOTE
    M-x el-get-install RET restart-emacs
    #+END_QUOTE

** Usage
   It offers only one command ~restart-emacs~ which kills current Emacs session
   and starts a new session.

   Additional arguments to be passed to the new instance can be specified using
   prefix arguments

   - with a single ~universal-argument~ (=C-u=) Emacs is restarted with ~--debug-init~ flag
   - with two ~universal-argument~ (=C-u= =C-u=) Emacs is restarted with ~-Q~ flag
   - with three ~universal-argument~ (=C-u= =C-u= =C-u=) the user is prompted for the arguments

** Compatibility
*** Restarting GUI Emacs
    Restarting graphical Emacs should work on any UNIXy system with ~sh~ and on
    Windows.

*** Restarting Emacs running in a terminal
    This requires that the shell from which Emacs was launched supports job
    control.  This has been tested to work on ~sh~, ~bash~, ~zsh~, ~fish~, ~csh~
    and ~tcsh~, however this does not work on Windows.
