How to Evaluate Emacs Lisp Code
To evaluate a single lisp expression, move your cursor to the right of the last closing parenthesis, and call
eval-last-sexp 【Ctrl+x Ctrl+e】.
To evaluate all elisp code in a text selection, call
Here's ways to eval elisp code, roughly in order of usefulness:
|Command Name||Acting Area||Key|
|the complete lisp expression to the left of cursor||【Ctrl+x Ctrl+e】|
|the function definition block (defun) the cursor is in.|
(the elisp code must be well-indended, otherwise emacs may have problem finding function.)
(only when in lisp modes)
|whole file in current window||◇|
|prompts you for a file name||【L】 in dired.|
|prompts you to type code||【Alt+:】 or 【Esc :】|
Emacs Lisp Command Line Interface (REPL)
Emacs has a interactive emacs lisp shell. Call
ielm to start.
I recommend working in a buffer instead of REPL.
Working in a buffer (sometimes called notebook inteface) allows you to use full editing power, and eval any expression, in any order, anytime, anywhere.
or, buy something from Best Keyboard for Emacs