5

I want autocompletion and refactoring in emacs with python.

I gather that I need rope to do this. To do this with emacs, I need ropemacs. Ropmacs depends on pymacs.

Pymacs is hard to install...or at least the instructions are not clear to me.

Do I need to do two things? Install pymacs and then install a file that tells emacs to talk to pymacs? I've already installed rope and ropemacs super easily, with

pip install rope ropemacs

Here's what I did:

pip install -e "git+https://github.com/pinard/Pymacs.git#egg=Pymacs"

This installs ok on mac os x mountain lion according to PIP.

But I have a feeling that I am not done--or am I?

How do I test to see if pymacs and rope and ropemacs are all working?

user798719
  • 9,619
  • 25
  • 84
  • 123

3 Answers3

7

I think the easiest way to install ropemacs is to use el-get: M-x el-get-install ropemacs. It installs and build Pymacs, rope and ropemacs. I know that it works on Linux. See the el-get document for more information. (disclaimer: I wrote the installation recipe for el-get so obviously I am biased to my solution)

The difference from the solution using pip is that it setups the Emacs side of Pymacs correctly.

tkf
  • 2,990
  • 18
  • 32
  • 1
    A few lines detailing how to get some basic use of ropemacs and what to add to your .emacs would be really useful here. Despite having run the el-get-install ropemacs without errors, I am still missing the steps necessary to get this package working... – RussellStewart Sep 15 '13 at 22:14
  • In spite of it's title, this question only enquired about installing pymacs. Meanwhile you can tell if pymacs is working by doing M-x pymacs-eval, and then entering a simple python expression. For example: [i*2 for i in range(1..10)] should return (2 4 6 8 10 12 14 16 18). – Ben Hyde Jul 27 '15 at 02:49
7

Installation section of Pymacs manual is fairly straightforward — don't be afraid to refer to it if unsure. Below are the steps to install Pymacs in Emacs 24. First, in shell, run:

sudo pip install rope ropemacs

After that in Emacs install Elisp side of Pymacs by adding Marmalade repository and then running package-install pymacs. As of February 2014 you can't install Pymacs via pip, therefore:

git clone http://github.com/pinard/pymacs
cd pymacs
make check
sudo make install

make check ensures the prerequisites. sudo make install puts Pymacs module in Python local modules path, usually /usr/local/lib/python2.7/dist-packages/. People generally frown upon make install, because if you lose the Makefile, it can become hard to cleanly uninstall. But you shouldn't fear it, as pip uses the same directory, so pip uninstall pymacs will work.

In ~/.emacs.d/init.el put:

;; 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)
(autoload 'pymacs-autoload "pymacs")

Evaluate this with eval-region and try running Python expressions with pymacs-eval. You're good to go.

Mirzhan Irkegulov
  • 17,660
  • 12
  • 105
  • 166
  • 1
    So I have to compile pymacs for each virtualenv? I think pymacs installation procedure needs a bit of modernization. – kovan May 03 '14 at 11:05
  • Windows users here.. the `Makefile` is kinda scary here. – swdev May 06 '14 at 22:55
  • Except that http://pymacs.progiciels-bpi.ca/pymacs.html does not answer and http://pymacs.progiciels-bpi.ca/ only echoes its URL. Is there no second source on that installation instructions? It's not in the repo... – thoni56 Aug 30 '14 at 10:33
  • But +1 for the repetition of them here. Succeeded! – thoni56 Aug 30 '14 at 10:36
  • Thanks for the installation procedure. It it awkward, but it may be easier with an `el-get` recipe which does everything (did someone test it ? I couldn't ?) http://wikemacs.org/wiki/Python#With_el-get – Ehvince Nov 26 '14 at 14:20
  • d9k's answer points out that the full documentation is available in the Internet archive. – Ben Hyde Jul 27 '15 at 02:41
2

clone pymacs github, go to folder and proceed tutorial from author. http://pymacs.progiciels-bpi.ca/pymacs.html is now offline, if still so see tutorial at https://web.archive.org/web/20130627154513/http://pymacs.progiciels-bpi.ca/pymacs.html . Look at chapter "2.4) Install the Pymacs proper" and "2.5 Prepare your .emacs file". Chapters are small, have testing and recomendations for windows user.

d9k
  • 1,476
  • 3
  • 15
  • 28
  • 1
    Readers may overlook that the key point in this answer is that the documentation is available in the Internet Archive – Ben Hyde Jul 27 '15 at 02:40