I'm using Emacs in the terminal of Mac. Each time I exist an .el file and reopen another, I have to set lisp-interaction-mode. Is there some sort of command or item I can place in the .emacs file to make it so that this is the default every time I open a .el file?

  • (I'm curious why you prefer that mode for an Emacs-Lisp code file, instead of emacs-lisp-mode.)
    – Drew
    Feb 1, 2018 at 4:39
  • Good question. I'm a CSCI major in my senior year and in a class that requires us to learn Elisp. While I've written many applications in other languages, I have no knowledge of Elisp and only had very limited time with Emacs before this class. We haven't really begun to write anything useful with Elisp, just smaller functions. Our professor has asked us to use lisp-interaction-mode and to use ctrl+j to evaluate functions and function calls. I've never used emacs-lisp-mode to evaluate functions and expressions.
    – joe_04_04
    Feb 1, 2018 at 4:43
  • 1. The Emacs manual is your friend. 2. In Emacs-Lisp mode you can use C-x C-e to evaluate the sexp before point, and you can use C-M-x to evaluate a defun. 3. In any mode you can use M-: to evaluate a Lisp sexp that you enter at the prompt. 4. In any buffer with Lisp code you can use M-x eval-region or M-x eval-buffer, to evaluate code.
    – Drew
    Feb 1, 2018 at 14:48

1 Answer 1


Update auto-mode-alist, to give it an association between *.el and lisp-interaction-mode.

(add-to-list 'auto-mode-alist (cons "\\.el\\'" #'lisp-interaction-mode))

See the Elisp manual, node Auto Major Mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.