我不能在Mac上的Emacs中使用python模式(相对来说,我是一个OS X新手&不完全是Elisp专家)。
我从http://emacsformacosx.com/安装了Emacs。该版本在bob.porkrind.org上的名称为"GNU Emacs23.3.1 (x86_64-apple-darwin,NS apple-appkit-1038.36) of 2011-12-13“
我的~/.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。
发布于 2012-06-15 16:27:11
好的,下面是我如何让python模式(python-mode.el,而不是python.elc)在我的安装上工作:
~/Downloads上的/Applications/Emacs.app/Contents/Resources/lisp/progmodes/ ),并在~/.emacs文件中添加了以下行(替换所有其他对python或python模式的引用):(add-to-list‘加载路径目录(setq py-install- "/Emacs/directory/with/other/.el/files/python-mode.el-6.0.8") "/Emacs/directory/with/other/.el/files/python-mode.el-6.0.8") (需要'python-mode)
现在唯一剩下的问题是,通过交互式调用python-mode解释器也会创建不必要的缓冲区,这是由Python成功安装和激活造成的。
感谢@Ribtoks的链接,让我走上了正确的道路。
发布于 2012-06-14 16:40:06
尝试将其添加到您的.emacs文件中(同时,将path设置为您的python模式。我的文件位于.emacs.d/文件夹中),位于python-lisp-includes代码之前
(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-14 16:25:25
如果你的加载路径是正确的,你可以试着在它后面添加下面这一行吗?
(autoload 'python-mode "python-mode" "Python Mode." t)我使用的是Linux中的emacs。不知道这是否可能是Aquamacs的不同之处。无论如何,有一个用Python模式配置Aquamacs的page。我没有读过它,但也许它应该值得阅读,以获得任何相关的提示。:)
https://stackoverflow.com/questions/11028148
复制相似问题