3

我无法在 Mac OS X 上的 Emacs 中使用 python 模式(我是相对的 OS X 新手,不完全是 Elisp 专家)。

我从http://emacsformacosx.com/安装了 Emacs 。该版本报告为“bob.porkrind.org 上 2011-12-13 的 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

4 回答 4

1

尝试在您的 python-lisp-includes 代码之前将其添加到您的 .emacs 文件中(另外,设置您的 python 模式的路径。我的位于 .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

于 2012-06-14T08:40:05.990 回答
1

好的,这就是我如何让 python-mode ( python-mode.el, not 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)
    

现在唯一剩下的问题(由成功安装和激活python-mode创建)是,通过 Python 解释器的交互式调用也会创建不必要的缓冲区。

感谢@Ribtoks 提供的链接让我开始走上正确的道路。

于 2012-06-15T08:27:11.247 回答
0

python-shell 实例的自动创建应该在当前主干中修复,resp。最新发布的

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

于 2012-07-22T19:04:42.820 回答
0

如果您的加载路径是正确的,您可以尝试在其后添加此行吗?

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

我正在使用来自 Linux 的 emacs。不知道这是否可能与 Aquamacs 不同。无论如何,有一个使用 Python 模式配置 Aquamacs 的页面。没读过,但也许任何相关提示都值得一读.. :)

于 2012-06-14T08:25:24.797 回答