python - 让 Hello World 在 pymacs 中工作

标签 python emacs elisp pymacs

上下文:我一直在为 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/

相关文章:

python - 为 numba 优化对 numpy 数组的访问

emacs - 我如何让emacs像缩进定义一样缩进其他内容?

emacs - 在 Emacs 中,keyboard-escape-quit 不破坏其他窗口的最佳方法是什么?

Emacs 光标移动建议

python - 数据结构 python django

python - 套接字断开连接时退出 Python While 循环

emacs - Emacs切换到下一个窗口,而不考虑框架

Emacs:我可以更改已启动进程的名称吗?

python - 将数组/列表转换为字典的有效方法是什么?

emacs - JavaScript 的智能补全