Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is emacs the only elisp interpreter?

Tags:

emacs

elisp

I recently started using emacs and extending it with elisp. That makes me wonder: is emacs the only program that can evaluate elisp expressions or do dedicated elisp-interpreters exist?

like image 498
M0M0 Avatar asked Oct 26 '25 15:10

M0M0


1 Answers

You can use Elisp outside emacs if you use Guile

here is de documentation:

https://www.gnu.org/software/guile/manual/html_node/Using-Other-Languages.html

☸ sandas-nonpro (qa) in ~ via ⬢ v12.4.0 took 11s
❯ guile                                                                                                                                  ~
GNU Guile 3.0.7
Copyright (C) 1995-2021 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> ,language elisp
Happy hacking with Emacs Lisp!  To switch back, type `,L scheme'.
elisp@(guile-user)> (printf "Hello World!)

You can also write scripts in emacs lisp like this:

☸ sandas-nonpro (qa) in ~ via ⬢ v8.9.4
❯ cat > test.el                                                                                                                          ~
:;exec emacs -batch -l "$0" -f main "$@"

(defun main ()
  (print (version))
  (print (format "I did it. you passed in %s" command-line-args-left)))

;; Local Variables:
;; mode: emacs-lisp
;; End:

☸ sandas-nonpro (qa) in ~ via ⬢ v12.4.0
❯ chmod +x test.el                                                                                                                       ~

☸ sandas-nonpro (qa) in ~ via ⬢ v12.4.0
❯ ./test.el cat dog                                                                                                                      ~

"GNU Emacs 28.0.50 (build 2, x86_64-apple-darwin20.6.0, NS appkit-2022.60 Version 11.5.2 (Build 20G95))
 of 2021-09-15"

"I did it. you passed in (cat dog)"

But I encourage to use it inside emacs, use ielm buffer alot or eshell which is a shell that you can combine emacs lisp s-expressions with shell commands. and obviously gccemacs, if you pan to do intensive work in emacs.

like image 176
anquegi Avatar answered Oct 29 '25 06:10

anquegi