Python pymacs:一般问题和安装问题
我正在尝试为python开发设置emacs 从我所读到的内容来看,建议使用python-mode.el,而不是Emacs 22.3中的默认python.el。所以我开始了新的冒险 据我所知,python模式有几个依赖项,所以我需要安装rope、ropemode和ropemacs。除此之外,我还需要安装PyMac Q:正确吗? 这是我的新.emacs,现在:Python pymacs:一般问题和安装问题,python,emacs,rope,pymacs,Python,Emacs,Rope,Pymacs,我正在尝试为python开发设置emacs 从我所读到的内容来看,建议使用python-mode.el,而不是Emacs 22.3中的默认python.el。所以我开始了新的冒险 据我所知,python模式有几个依赖项,所以我需要安装rope、ropemode和ropemacs。除此之外,我还需要安装PyMac Q:正确吗? 这是我的新.emacs,现在: (custom-set-variables ;; custom-set-variables was added by Custom.
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(inhibit-startup-screen t)
'(tab-width 4))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(setq emacs-config-path "~/.emacs.d/")
(setq base-lisp-path "~/.emacs.d/site-lisp/")
(setq site-lisp-path (concat emacs-config-path "/site-lisp"))
(defun add-path (p)
(add-to-list 'load-path (concat base-lisp-path p)))
(add-path "")
(add-to-list 'load-path "~/.emacs.d")
(require 'psvn)
;; python-mode
;;
(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)
(setq pymacs-load-path '( "~/.emacs.d/site-lisp/rope"
"~/.emacs.d/site-lisp/ropemode"
"~/.emacs.d/site-lisp/ropemacs"))
(setq interpreter-mode-alist
(cons '("python" . python-mode)
interpreter-mode-alist)
python-mode-hook
'(lambda () (progn
(set-variable 'py-indent-offset 4)
(set-variable 'py-smart-indentation nil)
(set-variable 'indent-tabs-mode nil)
;;(highlight-beyond-fill-column)
(define-key python-mode-map "\C-m" 'newline-and-indent)
(pabbrev-mode)
(abbrev-mode)
)
)
)
;; pymacs
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
;; Search local path for emacs rope
;;
;; enable pymacs
;;
(require 'pymacs)
(pymacs-load "ropemacs" "rope-")
现在,当我启动emacs时,我收到以下错误消息:
("C:\\opt\\emacs-22.3\\bin\\emacs.exe")
Loading encoded-kb...done
Loading regexp-opt...done
Loading easy-mmode...done
Loading wid-edit...done
Loading edmacro...done
Loading derived...done
Loading advice...done
Loading cl-macs...done
Loading byte-opt...done
An error has occurred while loading `c:/opt/cygwin/home/akong/.emacs':
File error: Cannot open load file, pymacs
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
For information about GNU Emacs and the GNU system, type C-h C-a. [2 times]
让它稍微复杂一点:
出于工作原因,我不得不使用Python2.4,但我的电脑上安装了Python2.6。但显然,rope不喜欢2.4,所以我没有运行setup.py。我卸载/解压这些包,并将这些文件放在~/.emacs.d/site-lisp下。默认情况下,如果在命令提示符下调用python,则它是python 2.4可执行文件
Q:我如何才能成功加载“pymacs”?到目前为止,我从未使用过pymacs,但当我看到您的
.emacs
时,有一件事吸引了我的眼球,那就是您显然没有将pymacs目录添加到emacs加载路径,而只是添加到pymacs
一个:
(setq pymacs-load-path '( "~/.emacs.d/site-lisp/rope"
"~/.emacs.d/site-lisp/ropemode"
"~/.emacs.d/site-lisp/ropemacs"))
您可能还需要以下内容:
(add-to-list 'load-path "~/.emacs.d/site-lisp/rope")
(add-to-list 'load-path "~/.emacs.d/site-lisp/ropemode")
(add-to-list 'load-path "~/.emacs.d/site-lisp/ropemacs")
(或者您拥有的pymacs.el
)以便emacs可以找到lisp文件。也提到了
2.4正确安装Pymacs。。。对于Emacs部分
现在这通常是手工完成的。
首先,沿着路径选择一些目录
保存在Emacs加载路径中的列表,用于
您有写访问权和复制权限
文件pymacs.el在该目录中
结果我错过了这两个:
(add-to-list 'load-path "~/.emacs.d/site-lisp/Pymacs-0.23")
显然,我需要加载pymac脚本
我已经将env var PYMACS_PYTHON设置为PYTHON 2.6,因为出于工作原因,我使用PYTHON 2.4作为默认的PYTHON解释器。如果缺少路径,那么这将很容易在启动日志中发现,或者在emacs启动时获得回溯。如果有疑问,M-x加载库是一种方法
在最新的Debian测试更新之后,我也发现ropemacs公司拒绝同时加载emacs 23和emacs 24,这意味着由于rope save hook,您无法保存文件。我很想听听任何一个正在工作的人的意见。一段时间以来,Macs和python公司与emacs的合作一直是一个难题。我打算稍后再尝试调试它,然后更新这个线程。唉,按照建议添加了行,但运气不好。那么你在哪里有pymacs.el?如果加载路径变量包含这个目录(C-hv:load path),也要检查它。我想你不需要(添加到列表“加载路径”~/.emacs.d/site lisp/rope”)
等等,因为rope、ropemode和ropemacs是通过pymacs加载的python包,所以它们只需要位于PYTHONPATH或pymacs加载路径中。ropemacs目录中没有Emacs lisp文件。请注意,没有(需要“ropemacs)
或类似的内容。