在Mac OS X上无法让Ethon中的python-mode工作

时间:2012-06-14 06:57:44

标签: python macos emacs

我无法让Mac OS X上的Emacs中的python-mode工作(我是相关的OS X新手,而不是Elisp专家)。

我从http://emacsformacosx.com/安装了Emacs。该版本于2011-12-13在bob.porkrind.org上报告为“GNU Emacs 23.3.1(x86_64-apple-darwin,NS apple-appkit-1038.36)”

我的~/.emacs文件中有以下几行:

(add-to-list 'load-path "/Applications/Emacs.app/Contents/Resources/lisp/progmodes")
(setq auto-mode-alist
      (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
      (cons '("python" . python-mode) interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python Editing Mode" t)

但每当我加载带有.py扩展名的文件时,模式仍然是Fundamental

4 个答案:

答案 0 :(得分:1)

在你的python-lisp-includes代码

之前,尝试将它添加到你的.emacs文件中(同样,设置你的python-mode的路径。我的是在.emacs.d /文件夹中)。
(add-to-list 'load-path "~/.emacs.d/python-mode")
(require 'python-mode)

在这里查找文件 http://www.emacswiki.org/emacs/?action=browse;oldid=PythonMode;id=PythonProgrammingInEmacs

答案 1 :(得分:1)

好的,这就是我如何使用python-mode(python-mode.el,而不是python.elc)来处理我的安装:

  1. python-mode.el-6.0.8.tar.gz下载到我的~/Downloads文件夹。
  2. pushd /Emacs/directory/with/other/.el/files(这个目录在我的机器上实际上是/Applications/Emacs.app/Contents/Resources/lisp/progmodes/
  3. tar -xzf ~/Downloads/python-mode.el-6.0.8.tar.gz
  4. popd
  5. 然后将以下行添加到我的~/.emacs文件中(替换所有其他对python或python-mode的引用):

    (add-to-list 'load-path "/Emacs/directory/with/other/.el/files/python-mode.el-6.0.8")
    (setq py-install-directory "/Emacs/directory/with/other/.el/files/python-mode.el-6.0.8")
    (require 'python-mode)
    
  6. 现在唯一剩下的问题 - 这是由成功的安装&激活python-mode - 是通过Python解释器的交互式调用创建了一个不必要的缓冲区。

    感谢@Ribtoks提供的链接,让我沿着正确的路径开始。

答案 2 :(得分:0)

如果你的加载路径是正确的,你可以尝试在它之后立即添加这条线吗?

(autoload 'python-mode "python-mode" "Python Mode." t)

我正在使用Linux上的emacs。不知道这可能与Aquamacs有什么区别。 无论如何,有一个page用于配置Aquamacs的Python模式。 没有读过它,但也许值得阅读任何相关的提示.. :)

答案 3 :(得分:0)

自动创建python-shell实例应该在当前的trunk中修复。最新版本

如果没有,请提交报告 https://bugs.launchpad.net/python-mode