Emacs For Python

本文详细介绍了如何配置并实践改进Python IDE集成开发环境,包括安装IPython、Pymacs和ropemacs,配置相关初始化文件,以及实现代码重构、补全、与Python shell交互等功能。通过关键配置和实践步骤,旨在提高开发效率和代码质量。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#### 改进

1. auto-complete 的 parser 的 结果 刷新会有延迟。一个名字更改之后,老名字应该立即去除。


#### 实践

综合了 主干blog 的配置(其实就是 python-mode 安装包里的 INSTALL 和 README 的 提示) 和 Emacs Wiki 上 IPython 的 配置。

0.配置放置在 python-mode-init.el 中。


1.Install IPython

Linux:

sudo apt-get install ipython-notebook : 12.10 得到的是 0.12.1
ref :  http://ipython.org/install.html

 

Windows:

 IPython 工作得不好: 没有 输出。 ( 最后使用的是 Python.exe 


py-execute-region 是 python-mode.el 的 func。

没有用到 IPython Completions,而且,src code (6.1.2 ) 中,没有出现 在 buffer 中显示 completion 别且切换到 buffer 中的 code


2 安装 Pymacs 和 ropemacs。

(0) apt-get install pyrope

(1) Pymacs : git clone --> checkout (tag) v0.25 --> make 

详细,查看 makefile 中的 各个 targets 。

先 make ,再 test , 再 sudo make install 。


(2)apt-get install pyropemacs


3. 配置 pymacs-init.el

初始化 project root  :

C-x p o : rope-open-project


KeyCommand
M-/ rope-code-assist
M-?rope-lucky-assist
C-c grope-goto-definition
C-c drope-show-doc
C-c frope-find-occurrences
C-c r srope-change-signature


C-c r mrope-extract-method
C-c r irope-inline

C-x p urope-undo
C-x p rrope-redo



需求:

1. 重构:方便、精确 的 refactor 很重要

2. 

3.

4. 和 Python shell 交互 --> buffer 中的 code 直接发送到 emacs 中 执行 : 免了打开 IDLE

5. 补全 并且 candidate 不会以 buffer 的 形式 弹出


Misc :

代码折叠: 带有 GUI 的东西,如果只是 plain code 的话,GUI 的 初始化 函数会有很多。 

code check / syntax check : flymake :pyflakes

 查询 Python 文档(次要)


emacs wiki  同时讲述 多个 alternatives,太混乱,于是,我找了讲述 某个 suite 的 blog,了解概要,链接如下:

http://www.jesshamrick.com/2012/09/18/emacs-as-a-python-ide/


####

1. Pymacs(后端,负责 python 和 LISP 交互) 和 Ropemacs

2.

3. Ropemacs ( 需要  RopeRopemodePymacs and Ropemacs  )

4. IPython :(0.14) 以上

5. auto-complete + Python-mode | Rope : better


#### Suite

1. emac-for-python : epy-init.el


#### Links

0. IPython :  here(0.14):

1.Python Mode : download : Configs 

2.禁止 补全 以 buffer 形式 弹出

3. Pymacs Pymacs code

Ropemacs ropemacs code


#### Dependency

0.  python-mode.el

1. IPython : pre : Python 2.7

IPython : 和  Python-mode 兼容, Ropemacs 和 Python-mode 兼容(使用 Python-mode hook)

2. Ropemacs : rope + pymacs 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值