Next: , Previous: , Up: Interactive Evaluation and Executing Lisp Expressions   [Index]


F.1.6.7 The Interactive Emacs Lisp Mode—ielm

An alternative way (to Lisp Interactive Mode) of evaluating Emacs Lisp expressions interactively is to use Inferior Emacs Lisp mode, which provides an interface rather like Shell mode for evaluating Emacs Lisp expressions. Type M-x ielm to create an ielm buffer which uses this mode.

M-x ielm

Run the elisp REPL. The mode inherits from ‘comint’ (command history, limited TAB completion).

*’, ‘**’, ‘***’ to get the last three outputs from the shell.

Working buffer—a buffer through which your changes are evaluated. Typing ‘C-c C-b’ allows you to choose ielm’s working buffer, so that all the code you evaluate thereafter will be treated as if you executed it in the context of that buffer. This functionality comes in handy if you are dealing with buffer-local variables or changes that’re specific to one buffer only.

Auto-Complete

By default ielm is not supported in auto complete. To make it so, add this code to you ‘.emacs’:

(defun ielm-auto-complete ()
  "Enables `auto-complete' support in \\[ielm]."
  (setq ac-sources '(ac-source-functions
                     ac-source-variables
                     ac-source-features
                     ac-source-symbols
                     ac-source-words-in-same-mode-buffers))
  (add-to-list 'ac-modes 'inferior-emacs-lisp-mode)
  (auto-complete-mode 1))
(add-hook 'ielm-mode-hook 'ielm-auto-complete)