XBEL file of links generated from Akara content
RSS feed

Style

(Cookies required)
Powered by 4Suite

This is a quick start guide for getting bicyclerepairman working with pymacs. I've found it to be quite an incredibly useful utility for debuging / reading / refactoring python code.

Things you need:

Installing Bicycle Repair Man

Check it out from their CVS:

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/bicyclerepair login 
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/bicyclerepair co bicyclerepair

Note, there are some problems with indentation and odd characters in the CVS code. Included in this Akara entry are the offending files modified to remove these characters (I simply removed the lines).

Install using: python setup.py install

Then read README.emacs for instructions on the installation of Pymacs (included with Bicycle Repair Man) and activation of Bike/Emacs integration. Note: Bicycle Repair Man can also be integrated with Idle.

Setting up Pymacs After installing Pymacs, you need to update your emacs configuration files in order to have Pymacs and Bicycle Repair Man automatically loaded when Emacs is started up. The following is my ~/.emacs file:

;; pymacs
(autoload 'pymacs-load "pymacs" nil t)
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")

;;python-mode
(setq load-path (cons "/usr/local/share/emacs/21.3/site-lisp" load-path))
(autoload 'python-mode "python-mode" "Python editing mode." t)
(setq auto-mode-alist
      (cons '("\\.py$" . python-mode) auto-mode-alist))

;;; add these lines if you like color-based syntax highlighting
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)

(pymacs-load "bikeemacs" "brm-")
(brm-init)


(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(tab-always-indent t))
(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 )

Note: you will need to change the first line in the python-mode section (setq load-path) to reflect the location of your site-lisp directory for your particular installacion of Emacs.

At this point, after you startup Emacs and load up a Python file you should have (in addition to menus specific to the python-mode) a Bike Repairman Menu with the entries to perform a handful of refactorings :

  • extractMethod
  • renameClass
  • findDefinition
  • findReferences

and others..

The attached (modified) files should be copied into the bicyclerepairman branch checked out from their CVS repository before installation:

  • bicyclerepair/ide-integration/bikeemacs.py (minor fixes - petitioning author to checkin to their CVS)
  • bicyclerepair/ide-integration/Pymacs-0.20/pymacs-services (removed problematic characters)
  • bicyclerepair/ide-integration/Pymacs-0.20/pymacs.el (removed problematic characters)
  • bicyclerepair/ide-integration/Pymacs-0.20/setup-emacs.py (removed problematic characters)
  • bicyclerepair/ide-integration/Pymacs-0.20/setup.py (removed problematic characters)

Chimezie


Comments

Re: Using Bicycle Repair Man to streamline Python development   Respond to this comment
 
By on 2004-10-20

Akara was having problems with pymacs-services so, I've reattached it as pymacs-services.py (it's a python script, anyways). But it should be renamed back to pymacs-services or bicyclerepair/ide-integration/Pymacs-0.20/setup.py should be modified to:

#!/usr/bin/env python

import sys
sys.path.insert(0, '.')
from Pymacs import package, version
del sys.path[0]

from distutils.core import setup

setup(name=package,
      version=version,
      description='Interface between Emacs LISP and Python.',
      author_email='pinard@iro.umontreal.ca',
      scripts=['pymacs-services', 'pymacs-services.bat', 'rebox'],
      packages=['Pymacs'])
Re: Using Bicycle Repair Man to streamline Python development   Respond to this comment
 
By on 2004-10-21

Er... that should be (basically the first entry in the scripts list should be point to the correct file)

#!/usr/bin/env python

import sys
sys.path.insert(0, '.')
from Pymacs import package, version
del sys.path[0]

from distutils.core import setup

setup(name=package,
      version=version,
      description='Interface between Emacs LISP and Python.',
      author_email='pinard@iro.umontreal.ca',
      scripts=['pymacs-services.py', 'pymacs-services.bat', 'rebox'],
      packages=['Pymacs'])