Emacs Lisp: Run Emacs Lisp Script in Shell
You can run emacs lisp script in shell (terminal), using the
--script option. For example:
emacs --script elispfile.el
Prepare Your Emacs Lisp Script to Run in Batch Mode
When you write a elisp script to run in batch, make sure your elisp file is:
- self-contained; Doesn't depend on anything from your emacs init file.
- Explicitly load all libraries it needs (using
- Has necessary load path set in the script (For example,
(add-to-list 'load-path lib_path)) if it needs libs that's not part of standard GNU emacs install, just like you would with a Python or Ruby script.
How to start emacs on a Mac from command line?
If you are on a Mac, call it from the command line like this: