LoginSignup
14
12

More than 5 years have passed since last update.

EmacsのPython開発環境構築メモ

Last updated at Posted at 2013-08-21

emacswikiの文書をもとに設定を行う。
http://www.emacswiki.org/emacs/PythonProgrammingInEmacs

どれもこれもpymacsを要求してくるので適宜インストールする。
Ubuntuでは、apt-get install pymacsでインストールできる。

  • Emacs for Python
  • Elpy
  • Ropemacs

の三種類が紹介されている。とりあえずropemacsは面倒くさそうだったので
他の2つを試してみた。

Emacs for Python

インストールはちょっとハマったが、このEmacs for Pythonの仕組みをわかっていないだけであった。
これは、Emacsを完全にPythonの開発環境に変更するもので、Emacs自体を大きく変更する。
使うなら専用のEmacsを用意したほうが良いだろう。
既にある他のEmacs資産などの兼ね合いもあるので、導入は見送った。
なお、完成して出来た環境はとても使いやすそうであった。

  • rope
  • autocomplete
  • yasnippets

などとの連携も特に問題なくできていた

Elpy

インストール自体に少し手こずった。
まずpython.elが自分の環境では想定と違うものが使われているため上手く動かず。

自分の環境ではこれが使われている(emacs標準)
http://www.loveshack.ukfsn.org/emacs/python.el

想定しているのはこちらだった模様
https://github.com/fgallina/python.el

なので(require 'python)するときには注意が必要である。

imenuが上手く動かないので

(semantic-mode 1) 
(add-hook 'python-mode-hook
  (lambda ()
    (setq imenu-create-index-function 'python-imenu-create-index)))

このように設定して、動作するように修正したところ、特に問題なく使えた。

  • rope
  • autocomplete
  • yasnippets
  • imenu
  • nose

などとの連携も問題なく動作した。

14
12
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
12