This page shows you 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 a text selection, call
Here's a list of other ways, 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.|
(your cursor needs to be near top level.)
(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 :】|
For commands that do not have a key, you can assign them a key, or you can give them a alias for convenience, ⁖ “eb” for
Also, emacs has a interactive emacs lisp shell. Call
ielm to start.
I never liked programing in a shell interface, so i never used
ielm. I prefer a notebook-style interface.
With notebook interface, as in emacs buffer, you can use the full power of editor to edit any part of your code, and evaluate any part you want dynamically, with many different ways to evaluate them.