Search code examples
emacslispelisp

How to break out of an infinite loop in emacs lisp ? (environment: emacs)


I tried using ctrl-c then :a

But It doesn't work here.

My code is like:

(defun game-repl()
    (loop (print (eval (read)))))

then I run

(game-repl())
look()

Solution

  • (require 'cl)
    (loop (setq x (read))
          (if (eq x 'exit)
            (return)
            (print (eval x))))