More specifically:

  • If it is possible, what are the necessary steps?

  • If it is not, what are the technical reasons?

(Prompted by a recent question: Restart emacs from within emacs.)


The state as I see it consists of all the symbols and their bindings, i.e. the environment described in Intro Eval. Resetting is returning to a previous state; this could be a manually stored state or the initial state of the interpreter (corresponding to "starting from scratch").

I realize that Emacs is not a closed system, so anything having to do with its environment is out of our control, but saving and loading an "Elisp core dump" should be possible in theory.

Making sure that changes in .emacs and such take effect is a possible (although silly) application, but I believe this could be useful for debugging elisp code, too.

  • 1
    I disagree with the vote to close. The answer may be a clear "no", but the question is valid (and likely to be asked more than once on this site). – T. Verron Dec 16 '14 at 20:12

No, you can't. The reason is pretty obvious: All of Emacs' state is the interpreter state, including all buffers, windows, frames, processes, etc, i.e. your whole editing session. Even if you could reset the Lisp interpreter from within Emacs, the result would be exactly the same as restarting the Emacs process: The standard blank frame with the welcome screen.

So there's really no point in implementing a feature that all operating systems already provide.

| improve this answer | |

What do you mean, exactly, by "the state of the Emacs Lisp interpreter"? And what constitutes "resetting" that state for you?

In general, the answer is no, it is not feasible to reset the interpreter. When you start out from scratch, there are already lots of symbols defined in the obarray, lots of strings, arrays, and lists (cons cells) created, and so on.

You can delete symbols, strings, arrays, cons cells etc., of course, but there is no reasonable way to restore the initial state at which you started.

You can dump the state of Emacs, and then start a new session from such a dump. So in a sense that "resets" the interpreter. But you might not want to do that.

For information about dumping Emacs see the Elisp manual, node Building Emacs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.