Use ropemacs to complete Python code

Source: Internet
Author: User
Tags autoload

Rope is a python refactoring library.

Ropemacs is the Emacs interface of rope, and ropemacs depends on pymacs.

Pymacs is used to connect Emacs and python. With pymacs, you can call python in Emacs.

To use ropemacs to complete python in Emacs, first install pymacs (of course, first ensure that python has been installed), and then install rope and ropemacs in sequence. Write down the following in. emacs:CodeTo set pymacs:

 
; Initialize 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)

Next, write the following code to set ropemacs:

 
; Initialize rope
(Pymacs-load "ropemacs" "rope -")
(Setq ropemacs-enable-autoimport T)

If you open the. py file later, emacs will add a rope menu. When editing python, press m-/to display Python completion.

PS: In OSX, an error occurs when Emacs starts rope because Emacs does not inherit the environment variable pythonpath from the system. Therefore, you must use setenv to set the environment variable pythonpath at the beginning of. emacs.

 

: we re-installed OSX today and found that the environment variable pythonpath is not required in osx10.5. 10.5 The default settings of Python-2.5.1 installed by default can be found in the installed rope/ropemacs. After the last installation, the rope encountered an error because a python-2.5.1 was not used, but a python-2.5.2 was re-installed. By default, rope/ropemacs was not found in Python-2.5.2. (In addition, osx10.5 has built-in wxPython-2.8.4 in Python-2.5.1 installed by default)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.