I think I have a problem in my .emacs file and would like to place in it some function that would cause emacs to stop evaluating. I could then start a binary search to see where the problem is occurring.

  • Please clarify. I don't understand what you intend by "place it in some function" or "cause emacs to stop evaluating". (Have you tried just bisecting your init file, to find the problem?)
    – Drew
    Jan 1, 2023 at 16:50
  • It seems that (top-level) works just fine to run a bisect of the file. I located the problem area and fixed it.
    – tgunr
    Jan 1, 2023 at 18:21
  • How does this question help others? What was the problem? How did you fix it? The question isn't clear, and the answer isn't either.
    – Drew
    Jan 1, 2023 at 18:32
  • The question seems quite clear, how do you stop emacs from further evaluating code. The (top-level) when encountered will stop further evaluation. What the problem was does not matter, I wanted a way to simply put something in my .emacs top prevent evaluating code so I did not have to resort to commenting out or deleting text. Using (top-level) allowed me to bisect my .emacs until I found what was causing my issue. Anyone else stumbling across this may find it useful to stop code evaluation.
    – tgunr
    Jan 1, 2023 at 21:39
  • As a further example I have this in my .emacs also now to stop further evaluatiion when I am using a different emacs version. ;; ;; WARNING!! don't execute anything below here if using plain old emacs (if (string-equal "/usr/bin/emacs" (getenv "EMACS")) (top-level))
    – tgunr
    Jan 1, 2023 at 21:41

1 Answer 1


I think I found it. Entering


seems to accomplish the goal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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