【问题标题】:Emacs + Rope + Python produces lisp errorEmacs + Rope + Python 产生 lisp 错误
【发布时间】:2012-02-24 16:16:03
【问题描述】:

我正在尝试在 Emacs 中将 Ropemacs 与 AutoComplete 一起使用,但我不断收到调试器错误:

Debugger entered--Lisp error: (void-function rope-completions)
  (rope-completions)
  eval((rope-completions))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)

符号rope-completions 没有来自 C-h S 的文档。它只出现一次,在自动完成配置中。我已经下载了最新的ropemacs、ropemode、pymacs、python-rope,并且可能破坏了我拥有的任何 apt 系统一致性。

当我从配置文件中删除此功能时,自动完成会在尝试完成时将光标变为红色。我在我的系统上的任何地方都找不到对这个函数的引用。

自动完成在 Lisp 中非常适合我。如何让自动完成功能和 Rope 协同工作以在 Emacs 中为 Python 提供自动完成功能?

编辑:我无法通过 C-h f 看到绳索完成的定义。这是我的 Pymacs 缓冲区的输出:

<23 (version "0.24-beta2")
>45 eval pymacs_load_helper("ropemacs", "rope-")
<278    (return '(progn (pymacs-defuns '(0 rope--OldProgress nil 1 rope--LispProgress nil 2 rope-LispUtils nil 3 rope-message nil 4 rope--lisp-name nil 5 rope--load-ropemacs nil 6 rope--started-from-pymacs nil 7 rope-occurrences-goto "" 8 rope-occurrences-next "")) (pymacs-python 9)))
>45 eval pymacs_load_helper("ropemacs", "rope-")
<288    (return '(progn (pymacs-defuns '(10 rope--OldProgress nil 11 rope--LispProgress nil 12 rope-LispUtils nil 13 rope-message nil 14 rope--lisp-name nil 15 rope--load-ropemacs nil 16 rope--started-from-pymacs nil 17 rope-occurrences-goto "" 18 rope-occurrences-next "")) (pymacs-python 19)))
>51 eval free_python(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19)
<13 (return nil)
>45 eval pymacs_load_helper("ropemacs", "rope-")
<279    (return '(progn (pymacs-defuns '(19 rope--OldProgress nil 9 rope--LispProgress nil 8 rope-LispUtils nil 7 rope-message nil 6 rope--lisp-name nil 5 rope--load-ropemacs nil 4 rope--started-from-pymacs nil 3 rope-occurrences-goto "" 2 rope-occurrences-next "")) (pymacs-python 1)))

【问题讨论】:

    标签: python emacs autocomplete ropemacs rope


    【解决方案1】:

    我最终能够做到的唯一方法是忽略所有其他教程,只使用Emacs For Python Github。它工作得非常好,结合了很多我一直希望使用的包,并且很容易配置,因此不会弄乱我现有的绑定和设置。

    【讨论】:

      【解决方案2】:

      你的 emacs 设置中有类似的东西吗? (另见:agr / ropemacs / overview — Bitbucket

      (require 'pymacs)
      (pymacs-load "ropemacs" "rope-")
      

      如果有,请检查是否有ropemacs 命令,例如rope-open-project (C-x p o)。

      请注意,rope-completions 被定义为 python 函数,因此您不会在 elisp 源代码中看到它的定义。

      如果你正确加载ropemacs,你会在点击C-h f rope-completions RET(不是C-h S)时看到这个。

      rope-completions is an interactive Lisp function.
      
      (rope-completions &rest ARGUMENTS)
      
      It interfaces to a Python function.
      

      【讨论】:

      • 感谢您的回复!我已经将enigmacurry.com/2009/01/21/… 几乎直接复制到了我的 .emacs 文件中。它仍然不起作用:(
      • 你能像我上面描述的那样检查你是否正确加载了ropemacs吗?顺便说一句,如果您不关心ropemacs 并且只想完成,也许您应该尝试chrispoole.com/project/ac-python
      • C-x p o 绑定到命令 icicle-bookmark-other-window (即使在 Python 缓冲区中)并且命令rope-open-project 不存在。我会试试你今天指出的链接。
      • 那么问题是ropemacs(或pymacs),而不是自动完成。首先,检查 pymacs 是否正确加载。删除所有(autoload 'pymacs-...) 行并放入(require 'pymacs)。如果您在启动 emacs 时出现错误,则说明加载路径中没有 pymacs.el。如果键入&lt;f1&gt; f pymacs-apply RET 时可以看到文档,则 pymacs 设置正常。然后检查是否可以在 Emacs 中导入rope。启动 python shell 并检查 import ropeimport ropemacsimport ropemode 是否失败。我猜至少其中一个失败了。如果是这样,请将这些模块放在您的 PYTHONPATH 中。
      • 您说您“几乎直接”复制了,但您从未提及您拥有的ropemode/ropemacs 版本。我必须至少从 hg 安装才能完成(它在ropemode/interface.py 中定义为 def 完成,前缀“rope-”由 pymacs 添加)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多