Skip to main content

An emacs mode for rope refactoring library

Project description

Ropemacs is an emacs mode that uses rope library to provide features like refactorings and code-assists. You should install rope library and Pymacs before using ropemacs.

New Features

  • Auto-completing python names (code-assist); M-/

  • Rope find file; C-c p f

  • Generate python element; C-c n [vfcmp]

  • Previewing changes

  • Specifying refactoring options

  • Restructuring support

  • Added rope-confirm-saving variable

  • Only activating local keys in python mode

  • Find file and advanced matching

Setting Up

You can get Pymacs from http://www.iro.umontreal.ca/~pinard/pymacs/. But version 0.22 does not work with Python 2.5 because of the lack of file encoding declarations. A simple patch is included: docs/pymacs_python25.patch.

After installing pymacs, add these lines to your ~/.emacs file:

(require 'pymacs)
(pymacs-load "ropemacs" "rope-")
(rope-init)

Rope registers its local keys using python-mode hook. If you don’t want to use rope with python-mode you can add rope-register-local-keys lisp function to some other hook.

If you want to load ropemacs only when you really need it, you can use a function like this instead of that:

(defun load-ropemacs ()
  "Load pymacs and ropemacs"
  (interactive)
  (require 'pymacs)
  (pymacs-load "ropemacs" "rope-")
  (rope-init)
  (setq rope-confirm-saving 'nil)
)

And execute load-ropemacs whenever you want to use ropemacs. Also if you don’t want to install rope library and ropemacs you can put them somewhere and add them to the PYTHONPATH before loading ropemacs in your .emacs:

(setenv "PYTHONPATH" (concat (getenv "PYTHONPATH")
                             ":/path/to/extracted/rope/package"
                             ":/path/to/extracted/ropemacs/package"))

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page