简体   繁体   English

emacs 是唯一的 elisp 解释器吗?

[英]Is emacs the only elisp interpreter?

I recently started using emacs and extending it with elisp.我最近开始使用 emacs 并用 elisp 扩展它。 That makes me wonder: is emacs the only program that can evaluate elisp expressions or do dedicated elisp-interpreters exist?这让我想知道:emacs 是唯一可以评估 elisp 表达式的程序还是存在专用的 elisp 解释器?

You can use Elisp outside emacs if you use Guile如果你使用 Guile,你可以在 emacs 之外使用 Elisp

here is de documentation:这是文档:

https://www.gnu.org/software/guile/manual/html_node/Using-Other-Languages.html 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:您还可以像这样在 emacs lisp 中编写脚本

☸ 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.但我鼓励在 emacs 中使用它,使用 ielm buffer alot 或 eshell,它是一个 shell,您可以将 emacs lisp s 表达式与 shell 命令结合起来。 and obviously gccemacs, if you pan to do intensive work in emacs.显然 gccemacs,如果你在 emacs 中进行密集工作。

CLOCC / CLLIB / elisp.lisp allows running Emacs-Lisp code from Common Lisp. CLOCC / CLLIB / elisp.lisp允许从 Common Lisp 运行 Emacs-Lisp 代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM