5.29 How do I execute (“evaluate”) a piece of Emacs Lisp code?
- If you want it evaluated every time you run Emacs, put it in a file named . ...
- You can type the form in the *scratch* buffer, and then type LFD (or C-j ) after it. ...
- In emacs-lisp-mode , typing C-M-x evaluates a top-level form before or around point.
How do you evaluate a lisp expression?
The most general command for evaluating Lisp expressions from a buffer is eval-region. M-x eval-region parses the text of the region as one or more Lisp expressions, evaluating them one by one. M-x eval-current-buffer is similar but evaluates the entire buffer.
How do I run a lisp in emacs?
To load an Emacs Lisp file, type M-x load-file . This command reads a file name using the minibuffer, and executes the contents of that file as Emacs Lisp code. It is not necessary to visit the file first; this command reads the file directly from disk, not from an existing Emacs buffer.