Programming

The Interactive Emacs-Lisp Mode

steloflute 2012. 8. 11. 22:00

http://www.masteringemacs.org/articles/2010/11/29/evaluating-elisp-emacs/


M-x ielm



The Interactive Emacs-Lisp Mode

This is a fantastic, and hidden, gem in Emacs: a proper REPL. Type M-x ielm to run the elisp REPL. It comes with all the useful features you would expect from an interactive shell, like *** and *** to get the last three outputs from the shell. Multi-line commands are fully supported as well, of course.

Because ielm inherits from comint you get all the advantages that provides, like a command history and so on. You also get limited completion support with TAB, which is very nice.

Another useful feature is the concept of a working buffer – a buffer through which your changes are evaluated. If you type C-c C-b you can change ielm’s working buffer to one of your choosing and then all the code you evaluate thereafter will be treated as if you executed it in the context of that buffer. This functionality comes in handy if you are dealing with buffer-local variables or changes that’re specific to one buffer only. Very, very powerful.