Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
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?)
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.
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))
(top-level)
works just fine to run a bisect of the file. I located the problem area and fixed it.(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.;; ;; WARNING!! don't execute anything below here if using plain old emacs (if (string-equal "/usr/bin/emacs" (getenv "EMACS")) (top-level))