上下文:我一直在为 python 使用 ropemacs,并设置并运行了 pyemacs。我想开始使用 python 编写 emacs(我有一些使用 elisp 编写 emacs 的经验)。我从 Hello World 示例开始。
我用 docs 中的示例创建了 ~/.emacs.d/hello.py :
from Pymacs import lisp
def hello_world():
lisp.insert("Hello from Python!")
hello_world.interaction = ''
然后我尝试在我的初始化文件中加载 hello.py:
(eval-after-load "pymacs"
'(add-to-list 'pymacs-load-path "~/.emacs.d/"))
(pymacs-load "hello") ;;this line fails
(require 'hello)
我收到以下错误。我做错了什么?
Debugger entered--Lisp error: (error "Pymacs loading hello...failed")
signal(error ("Pymacs loading hello...failed"))
pymacs-report-error("Pymacs loading %s...failed" "hello")
(cond (lisp-code (let ((result (eval lisp-code))) (message "Pymacs loading %$
(let ((lisp-code (pymacs-call "pymacs_load_helper" module prefix))) (cond (l$
pymacs-load("hello")
eval((pymacs-load "hello") nil)
eval-last-sexp-1(nil)
eval-last-sexp(nil)
最佳答案
我可能有点晚了,但原因是你应该确保在将模块添加到 pymacs-load-path 后重新加载 pymacs 解释器,最简单的方法是杀死 Pymacs 缓冲区,它应该在之后工作
关于python - 让 Hello World 在 pymacs 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12437126/