GNU Info

Info Node: (efaq)Evaluating Emacs Lisp code

(efaq)Evaluating Emacs Lisp code


Next: Changing the length of a Tab Prev: Valid X resources Up: Common requests
Enter node , (file) or (file)node

How do I execute ("evaluate") a piece of Emacs Lisp code?
=========================================================

   There are a number of ways to execute ("evaluate", in Lisp lingo) an
Emacs Lisp "form":

   * If you want it evaluated every time you run Emacs, put it in a file
     named `.emacs' in your home directory.  This is known as "your
     `.emacs' file," and contains all of your personal customizations.

   * You can type the form in the `*scratch*' buffer, and then type
     <LFD> (or `C-j') after it.  The result of evaluating the form will
     be inserted in the buffer.

   * In `emacs-lisp-mode', typing `M-C-x' evaluates a top-level form
     before or around point.

   * Typing `C-x C-e' in any buffer evaluates the Lisp form immediately
     before point and prints its value in the echo area.

   * Typing `M-:' or `M-x eval-expression' allows you to type a Lisp
     form in the minibuffer which will be evaluated once you press
     <RET>.

   * You can use `M-x load-file' to have Emacs evaluate all the Lisp
     forms in a file.  (To do this from Lisp use the function `load'
     instead.)

     The functions `load-library', `eval-region',
     `eval-current-buffer', `require', and `autoload' are also useful;
     see Note: Emacs Lisp documentation, if you want to learn more
     about them.



automatically generated by info2www version 1.2.2.9