When Emacs starts up, it contains a buffer named ‘*scratch*’, which is provided for evaluating Lisp expressions interactively inside Emacs. Its major mode is Lisp Interaction mode.
The simplest way to use the ‘*scratch*’ buffer is to insert
Lisp expressions and type C-j (eval-print-last-sexp)
after each expression. This command reads the Lisp expression before
point, evaluates it, and inserts the value in printed representation
before point. The result is a complete typescript of the expressions
you have evaluated and their values.
At startup, the ‘*scratch*’ buffer contains a short message, in
the form of a Lisp comment, that explains what it is for. This
message is controlled by the variable initial-scratch-message,
which should be either a string or nil. If you set it to the
empty string, or nil, the initial message is suppressed.
All other commands in Lisp Interaction mode are the same as in Emacs Lisp mode. You can enable Lisp Interaction mode by typing M-x lisp-interaction-mode.
An alternative way of evaluating Emacs Lisp expressions interactively is to use Inferior Emacs-Lisp mode, which provides an interface rather like Shell mode (see Shell Mode) for evaluating Emacs Lisp expressions. Type M-x ielm to create an ‘*ielm*’ buffer which uses this mode. For more information see that command's documentation.
blog comments powered by Disqus