Use Emacs as the python integrated development environment

Source: Internet
Author: User

Python is a programming language that I like very much, while Emacs is a leader in the editor. Emacs provides Python-mode. Input M-x Python-mode to enter the python mode. Correspondingly, the python menu appears on the menu bar. Of course, in general, if the. py file is opened, it will automatically enter this mode.
However, the default Python Mode features are still a little weak in use, and it is not good in many places. It is best to download a third-party Python mode. Python-mode is an open-source project that can be downloaded at https://launchpad.net/python-mode.
1. Install
1) install prog-modes: aptitude install Prolog-El
2). Download The python-mode.el file on the project home page.
3). Compile: C-x C-F/path/to/python-mode.el RET
M-x byte-compile-file RET
4). Add the python-mode.el path to. emacs:
(Setq load-path (Cons "/DIR/of/Python-mode/" load-path ))
Check whether the extension is loaded. Test method: M-x locate-library RET Python-mode RET
2. Configure the. emacs file
(Setq auto-mode-alist

(Cons' ("//. py $". Python-mode) Auto-mode-alist ))

(Setq interpreter-mode-alist

(Cons' ("Python". Python-mode)

Interpreter-mode-alist ))

(Autoload 'python-mode "Python-mode" "Python editing mode." T)

; Add these lines if you like color-based syntax highlighting

(Global-font-lock-mode t)

(Setq font-lock-maximum-decoration T)

(Set-language-Environment 'Chinese-GB)

(Set-keyboard-coding-system 'euc-CN)

(Set-clipboard-coding-system 'euc-CN)

(Set-terminal-coding-system 'euc-CN)

(Set-buffer-file-coding-system 'euc-CN)

(Set-selection-coding-system 'euc-CN)

(Modify-coding-system-alist 'process "*" 'euc-CN)

(Setq default-process-coding-System

'(EUC-CN. euc-CN ))

(Setq-default pathname-coding-system 'euc-CN)

3. Operation
1) Run: c-c. The script will be executed in the new window and buffer zone;
2). C-J: Insert a new row with the same indentation;
3). C-M-A: Jump to the first function or class;
4). C-m-e: jump to the end of a function or class;
5). c-W: Run pychecker to check the code;
The general usage is like this. In addition, there are many templates for classes or functions that can be performed by using shortcut keys, which will be enhanced in the future. Thank you for seeing this!


This article is from the chinaunix blog. If you want to view the original text, click:Http://blog.chinaunix.net/u/15586/showart_1171325.html

 

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.