SlideShare a Scribd company logo
1 of 14
Download to read offline
Configure Emacs As a Python IDE 
Lingfei Kong 
2014-11-10 
Contents 
1 My Emacs Configure 1 
2 Emacs basic setting 1 
3 Packages or plugins need to install (Configure emacs as a 
python IDE) 6 
4 Install ECB 9 
5 Set font for emacs (you can ignore this if you already have 
a satisfactory font) 11 
6 Configure org-mode 12 
7 Reference 14 
1 My Emacs Configure slide 
2 Emacs basic setting slide 
;; .emacs 
;; ============================== Basic Configure START ===================================== 
;; set TAB=4 for C 
;;(setq c-basic-offset 4) 
;; 
;; show colume number 
;;(setq column-number-mode t) 
1
;; kill the buffer imediate 
(global-set-key (kbd "C-x k") ’kill-this-buffer) 
;; hide tool bar 
(tool-bar-mode -1) 
;; hide menu bar 
(menu-bar-mode -1) 
;;hide scroll bar 
(scroll-bar-mode -1) 
;; 
(setq use-dialog-box nil) 
;; 
(setq mouse-yank-at-point t) 
;; Emacs 
(setq auto-image-file-mode t) 
;;shelltelnetw3m, 
(add-hook ’comint-output-filter-functions 
’comint-watch-for-password-prompt) 
;;emacs 
(setq x-select-enable-clipboard t) 
;; 
(setq mouse-yank-at-point t) 
;;, 
(setq user-full-name "lkong") 
(setq user-mail-address "lkong@redhat.com") 
;; 
(setq require-final-newline t) 
;;F9Emacs 
(global-set-key [f9] ’calendar) 
2
;;F10 
(global-set-key [f10] ’list-bookmarks) 
;; dired 
(setq dired-recursive-copies ’top) 
(setq dired-recursive-deletes ’top) 
;;[C-f9]dired 
;;(global-set-key [C-f9] ’dired) 
;;control+spacemark 
(global-set-key (kbd "C-SPC") ’nil) 
;; C-@ setmark , C-@ 
;;(global-set-key (kbd "M-<SPC>") ’set-mark-command) 
(global-set-key [?S- ] ’set-mark-command) 
;; 
(setq backup-directory-alist ’(("." . "~/emacs_backup"))) 
;; 
;;(setq make-backup-files nil) 
;; 
(setq-default cursor-type ’bar) 
;; 
;; (setq-default cursor-type ’box) 
;; “” 
(setq inhibit-startup-message t) 
;; 
(transient-mark-mode t) 
;; 
(setq mouse-wheel-mode t) 
;; 
(setq column-number-mode t) 
3
;; 
(global-linum-mode 1) 
;; kill ring 
(setq kill-ring-max 200) 
;; fill-column 60. 
(setq default-fill-column 60) 
;; 
;;(show-paren-mode t) 
;;(setq show-paren-style ’parentheses) 
;; buffer emacs@wangyin.com 
(setq frame-title-format "emacs@%b") 
;; 
(put ’set-goal-column ’disabled nil) 
(put ’narrow-to-region ’disabled nil) 
(put ’upcase-region ’disabled nil) 
(put ’downcase-region ’disabled nil) 
(put ’LaTeX-hide-environment ’disabled nil) 
;; dired 
(setq dired-recursive-copies ’top) 
(setq dired-recursive-deletes ’top) 
;; auto enter new line 
(add-hook ’org-mode-hook (lambda () (setq truncate-lines nil))) 
;; set key f11 to switch to full 
(global-set-key [f11] ’my-fullscreen) ;; full screen 
(fset ’yes-or-no-p’y-or-n-p) 
;; statment highlight 
(global-font-lock-mode t) 
;; use a large kill ring 
(setq kill-ring-max 1024) 
4
;; Show the corse in which function 
(which-function-mode t) 
;; set default tab width 
(setq default-tab-width 4) 
;; do not use space to instead TAB 
(setq-default indent-tabs-mode t) 
;; enable global line number 
;;(global-linum-mode 1) 
;;M-ggoto-line 
(global-set-key (kbd "M-g") ’goto-line) 
;; No backup 
;;(setq backup-inhibited t) 
(defun my-fullscreen () 
(interactive) 
(x-send-client-message 
nil 0 nil "_NET_WM_STATE" 32 
’(2 "_NET_WM_STATE_FULLSCREEN" 0)) 
) 
;; let emacs to max frame 
(add-to-list ’load-path "~/.emacs.d/elpa/maxframe-20120725.639/") 
(require ’maxframe) 
(add-hook ’window-setup-hook ’maximize-frame t) 
;;#yum install wqy-microhei-fonts.noarch first 
;;(set-default-font "WenQuanYi Micro Hei Mono-19.5") 
(set-default-font "WenQuanYi Zen Hei Mono-25") 
;;(set-fontset-font (frame-parameter nil ’font) ’han "WenQuanYi Zen Hei Mono-24") 
;;(set-fontset-font (frame-parameter nil ’font) ’gb18030 "WenQuanYi Zen Hei Mono-24") 
;;(set-fontset-font (frame-parameter nil ’font) ’bopomofo "WenQuanYi Zen Hei Mono-24") 
;;(set-fontset-font (frame-parameter nil ’font) ’cjk-misc "WenQuanYi Zen Hei Mono-24") 
;;(set-fontset-font (frame-parameter nil ’font) ’nil "WenQuanYi Zen Hei Mono-24") 
;;(set-fontset-font (frame-parameter nil ’font) ’symbol "WenQuanYi Zen Hei Mono-24") 
;;(set-fontset-font (frame-parameter nil ’font) ’kana "WenQuanYi Micro Hei Mono-24") 
5
;; ============================== Basic Configure END ====================================== 
3 Packages or plugins need to install (Configure 
emacs as a python IDE) slide 
• Use yum to install packages in linux 
yum install packagename 
• Use list-packages or package-list-packages to install plugins in emacs 
You need first configure your package archives like: 
(setq package-archives ’(("gnu" . "http://elpa.gnu.org/packages/") 
("marmalade" . "http://marmalade-repo.org/packages/") 
("melpa" . "http://melpa.milkbox.net/packages/"))) 
• Packages need to install 
– YASnippet 
* Install yasnippet via list-packages 
Here is a link about list-packages: packages installation in 
emasc 
* Add configure for yasippet in .emacs 
(add-to-list ’load-path "~/.emacs.d/elpa/yasnippet-0.8.0/") 
(require ’yasnippet) 
(yas-global-mode 1) 
– auto-completion 
* Install auto-completion via list-packages 
* Add configure for auto-completion in .emacs 
6
(add-to-list ’load-path "~/.emacs.d/elpa/popup-20140815.629/") 
(require ’popup) 
(add-to-list ’load-path "~/.emacs.d/elpa/auto-complete-20140824.1658/") 
(require ’auto-complete-config) 
(add-to-list ’ac-dictionary-directories "~/.emacs.d/elpa/auto-complete-20140824.1658/(ac-config-default) 
– python-mode 
* Install python-mode via list-packages 
* Add configure for python-mode in .emacs 
(add-to-list ’load-path "~/.emacs.d/elpa/python-mode-6.1.3") 
(require ’python-mode) 
– ipython 
* Install ipython via yum install 
* Install ipython plugin via list-packages 
* Add configure for ipython in .emacs 
(add-to-list ’load-path "~/.emacs.d/elpa/ipython-2927/") 
(require ’ipython) 
– python document 
* Download pylookup from pylookup (this link is a git repo) 
You may download it to ~/.emacs.d/ 
* Download the newest python html document from python 
document 
download it to ~/.emacs.d/pylookup/ 
* ./pylookup.py -u python-2.7.1-docs-html to generate py-lookup. 
db 
7
* cp pylookup.py, pylookup.db, pylookup.el to ~/.emacs.d/plugins/pylookup 
* Add configure for python document in .emacs 
(setq pylookup-dir "~/.emacs.d/plugins/pylookup") 
(add-to-list ’load-path pylookup-dir) 
(require ’pylookup) 
;; load pylookup when compile time 
(setq pylookup-program (concat pylookup-dir "/pylookup.py")) 
(setq pylookup-db-file (concat pylookup-dir "/pylookup.db")) 
;; set search option if you want 
(setq pylookup-search-options ’("--insensitive" "0" "--desc" "0")) 
;; to speedup, just load it on demand 
(autoload ’pylookup-lookup "pylookup" 
"Lookup SEARCH-TERM in the Python HTML indexes." t) 
(autoload ’pylookup-update "pylookup" 
"Run pylookup-update and create the database at ‘pylookup-db-file’." (global-set-key "C-ch" ’pylookup-lookup) 
(setq browse-url-browser-function ’w3m-browse-url) 
* Install w3m via yum install 
* Install w3m via list-packages 
– anything 
– pylint 
* Install pylint via ‘yum install pylint‘ 
* Install pylint via list-packages 
* Add configure for pylint in .emacs 
8
(add-to-list ’load-path "~/.emacs.d/elpa/pylint-20140729.1117/") 
(require ’pylint) 
– pep8 
* Install pep8 via ‘easy_install pep8‘ 
* Install pep8 via list-packages 
* Add configure for pep8 in .emacs 
(add-to-list ’load-path "~/.emacs.d/elpa/pep8-1.2/") 
(require ’pep8) 
(require ’tramp) 
(add-hook ’before-save-hook ’delete-trailing-whitespace) 
– xcscope 
* Install cscope via ‘yum install cscope‘ 
* Install xcscope via list-packages 
* Add configure for xcscope in .emacs 
(add-to-list ’load-path "~/.emacs.d/elpa/xcscope-20140510.1437") 
(require ’xcscope) 
4 Install ECB slide 
• Install ecb via list-packages 
• Add configure for ecb in .emacs 
(add-to-list ’load-path "~/.emacs.d/elpa/ecb-20140215.114/") 
(setq ecb-tip-of-the-day nil) 
(require ’ecb) 
(require ’ecb-autoloads) 
(setq ecb-auto-activate t) 
9
(global-set-key [M-left] ’windmove-left) 
(global-set-key [M-right] ’windmove-right) 
(global-set-key [M-up] ’windmove-up) 
(global-set-key [M-down] ’windmove-down) 
(define-key global-map [(control f1)] ’ecb-hide-ecb-windows) 
(define-key global-map [(control f2)] ’ecb-show-ecb-windows) 
;;(define-key global-map [(control f3)] ’ecb-change-layout "left2") 
;;(define-key global-map [(control f3)] ’ecb-change-layout) 
;;(define-key global-map "C-c3" ’ecb-change-layout) 
(define-key global-map "C-c1" ’ecb-maximize-window-directories) 
(define-key global-map "C-c2" ’ecb-maximize-window-sources) 
(define-key global-map "C-c3" ’ecb-maximize-window-methods) 
(define-key global-map "C-c4" ’ecb-maximize-window-history) 
(define-key global-map "C-c‘" ’ecb-restore-default-window-sizes) 
(global-set-key [f12] ’ecb-activate) ;; ecb activate 
;;(define-key global-map "C-c1" ’ecb-maximize-window-methods) 
;;(define-key global-map "C-c2" ’ecb-maximize-window-history) 
;;(define-key global-map "C-c‘" ’ecb-restore-window-sizes) 
;; Disable buckets so that history buffer can display more entries 
(setq ecb-history-make-buckets ’never) 
(custom-set-variables 
;; custom-set-variables was added by Custom. 
;; If you edit it by hand, you could mess it up, so be careful. 
;; Your init file should contain only one such instance. 
;; If there is more than one, they won’t work right. 
’(ecb-create-layout-frame-height 10) 
’(ecb-create-layout-frame-width 50) 
’(ecb-layout-name "lkong") 
’(ecb-layout-window-sizes nil) 
’(ecb-options-version "2.40") 
’(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2)) 
’(ecb-toggle-layout-sequence (quote ("lkong2" "lkong"))) 
’(ecb-windows-width 0.225)) 
;;ecbTip 
10
(set-foreground-color "grey") 
(set-background-color "black") 
;;(setq ecb-layout-name "left10") 
(setq ecb-history-make-buckets ’never) 
(setq ecb-fix-window-size t) 
(ecb-activate) 
;; Ecb: 
;; C-c . g d 
;; C-c . g s 
;; C-c . g m 
;; C-c . g h 
;; C-c . g l 
;; C-c . g 1 1 
;; C-c . g n n 
;; C-c . l c 
;; C-c . l r 
;; C-c . l t switch layout 
;; C-c . l w ecb 
;; C-c . / 
;; C-c . e: jump to the eshell buffer 
;; C-c . n: histroy back 
;; C-c . p: histroy forwad 
;; C-c .h: Show ECB help pager 
;; left2: directory + source 
;; left6: source + method + history 
;; left8: directory + source + method + history 
– You may create your own layout via ’ecb-create-new-layout’, just 
follow the prompt 
5 Set font for emacs (you can ignore this if you 
already have a satisfactory font) slide 
• Install wqy font 
yum -y install wqy-zenhei-fonts.noarch 
11
yum -y install wqy-microhei-fonts.noarch 
yum -y install wqy-bitmap-fonts.noarch 
• fc-cache 
• fc-list |grep wqy 
• Add configre for wqy font in .emacs 
(set-default-font "WenQuanYi Zen Hei Mono-24") 
6 Configure org-mode slide 
In emacs24 org-mode is installed by default, if not you should install the 
following packages: 
• Install org via list-packages 
• Install emacs-common via yum install 
;; ============================ Org-mode Configure START ================================= 
(require ’org-install) 
(require ’org-publish) 
(add-to-list ’auto-mode-alist ’(".org’" . org-mode)) 
(add-hook ’org-mode-hook ’turn-on-font-lock) 
(add-hook ’org-mode-hook 
(lambda () (setq truncate-lines nil))) 
(global-set-key "C-cl" ’org-store-link) 
(global-set-key "C-ca" ’org-agenda) 
(global-set-key "C-cb" ’org-iswitchb) 
;;(global-set-key "C-cc" ’org-capture) 
(global-set-key "C-cc" ’org-remember) 
(add-to-list ’auto-mode-alist ’(".org’" . org-mode)) 
12
;; GTD -- start 
(setq org-todo-keywords 
(quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)") 
(sequence "SOMEDAY(s@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)")))) 
(setq org-todo-keyword-faces 
(quote (("TODO" :foreground "red" :weight bold) 
("NEXT" :foreground "blue" :weight bold) 
("DONE" :foreground "forest green" :weight bold) 
("SOMEDAY" :foreground "orange" :weight bold) 
("HOLD" :foreground "magenta" :weight bold) 
("CANCELLED" :foreground "forest green" :weight bold)))) 
(setq org-todo-state-tags-triggers 
(quote (("CANCELLED" ("CANCELLED" . t)) 
("SOMEDAY" ("SOMEDAY" . t)) 
("HOLD" ("SOMEDAY" . t) ("HOLD" . t)) 
(done ("SOMEDAY") ("HOLD")) 
("TODO" ("SOMEDAY") ("CANCELLED") ("HOLD")) 
("NEXT" ("SOMEDAY") ("CANCELLED") ("HOLD")) 
("DONE" ("SOMEDAY") ("CANCELLED") ("HOLD"))))) 
(setq org-directory "~/Org-mode") 
(global-set-key (kbd "C-c c") ’org-capture) 
(setq org-capture-templates 
(quote (("t" "todo" entry (file "~/Org-mode/todo.org") 
"* TODO %?n%an" :clock-in t :clock-resume t) 
("i" "idea" entry (file+datetree "~/Org-mode/idea.org") 
"* %? n") 
("s" "someday" entry (file "~/Org-mode/someday.org") 
"* SOMEDAY %? :SOMEDAY:n%an" :clock-in t :clock-resume t) 
("n" "note" entry (file "~/Org-mode/diary.org") 
"* %? :NOTE:n%an" :clock-in t :clock-resume t) 
("w" "org-protocol" entry (file "~/Org-mode/refile.org") 
"* TODO Review %cn%Un" :immediate-finish t)))) 
;;(setq org-tag-alist ’(("office" . ?o) ("home" . ?h) ("notes" . ?n) ("slide" . ?s))) 
;; GTD -- end 
;; Only show the last star 
13
;;(setq org-hide-leading-stars t) 
;;org mode 
(add-to-list ’auto-mode-alist ’(".org’" . org-mode)) 
(add-hook ’org-mode-hook ’turn-on-font-lock) 
(add-hook ’org-mode-hook 
(lambda () (setq truncate-lines nil))) 
;; Remove empty LOGBOOK drawers on clock out 
(defun bh/remove-empty-drawer-on-clock-out () 
(interactive) 
(save-excursion 
(beginning-of-line 0) 
(org-remove-empty-drawer-at "LOGBOOK" (point)))) 
(add-hook ’org-clock-out-hook ’bh/remove-empty-drawer-on-clock-out ’append) 
(defun gtd () 
(interactive) 
(find-file "~/Org-mode/todo.org") 
) 
(global-set-key (kbd "<f12>") ’list-bookmarks) 
(defun insert-current-time () 
"Insert the current time" 
(interactive "*") 
;;(insert (format-time-string "%Y/%m/%d %H:%M:%S" (current-time)))) 
(insert (format-time-string "%Y-%m-%d" (current-time)))) 
;;(insert (format-time-string "%H:%M:%S" (current-time)))) 
(global-set-key "C-xt" ’insert-current-time) 
;; ============================ Org-mode Configure END ================================= 
7 Reference slide 
• Configure python as a IDE 
14

More Related Content

What's hot

3. writing MySql plugins for the information schema
3. writing MySql plugins for the information schema3. writing MySql plugins for the information schema
3. writing MySql plugins for the information schemaRoland Bouman
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)CODE BLUE
 
Stacki: Remove Commands
Stacki: Remove CommandsStacki: Remove Commands
Stacki: Remove CommandsStackIQ
 
Endevor api an introduction to the endevor application programming interface
Endevor api   an introduction to the endevor application programming interface Endevor api   an introduction to the endevor application programming interface
Endevor api an introduction to the endevor application programming interface Kevin Grimes
 
はじめて Phantom と遭遇して、闇雲に闘いを挑んでみた話 #kbkz_tech
はじめて Phantom と遭遇して、闇雲に闘いを挑んでみた話 #kbkz_techはじめて Phantom と遭遇して、闇雲に闘いを挑んでみた話 #kbkz_tech
はじめて Phantom と遭遇して、闇雲に闘いを挑んでみた話 #kbkz_techTomohiro Kumagai
 
Pontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11gPontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11gLeandro Santos
 
Basic ASM by @binaryheadache
Basic ASM by @binaryheadacheBasic ASM by @binaryheadache
Basic ASM by @binaryheadachecamsec
 
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀EXEM
 
Call stack, event loop and async programming
Call stack, event loop and async programmingCall stack, event loop and async programming
Call stack, event loop and async programmingMasters Academy
 
Perl Sucks - and what to do about it
Perl Sucks - and what to do about itPerl Sucks - and what to do about it
Perl Sucks - and what to do about it2shortplanks
 
OOUG: Oracle transaction locking
OOUG: Oracle transaction lockingOOUG: Oracle transaction locking
OOUG: Oracle transaction lockingKyle Hailey
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDDEric Hogue
 

What's hot (19)

3. writing MySql plugins for the information schema
3. writing MySql plugins for the information schema3. writing MySql plugins for the information schema
3. writing MySql plugins for the information schema
 
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
 
Pdxpugday2010 pg90
Pdxpugday2010 pg90Pdxpugday2010 pg90
Pdxpugday2010 pg90
 
ZFINDALLZPROGAM
ZFINDALLZPROGAMZFINDALLZPROGAM
ZFINDALLZPROGAM
 
Stacki: Remove Commands
Stacki: Remove CommandsStacki: Remove Commands
Stacki: Remove Commands
 
Endevor api an introduction to the endevor application programming interface
Endevor api   an introduction to the endevor application programming interface Endevor api   an introduction to the endevor application programming interface
Endevor api an introduction to the endevor application programming interface
 
C99.php
C99.phpC99.php
C99.php
 
はじめて Phantom と遭遇して、闇雲に闘いを挑んでみた話 #kbkz_tech
はじめて Phantom と遭遇して、闇雲に闘いを挑んでみた話 #kbkz_techはじめて Phantom と遭遇して、闇雲に闘いを挑んでみた話 #kbkz_tech
はじめて Phantom と遭遇して、闇雲に闘いを挑んでみた話 #kbkz_tech
 
Pontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11gPontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11g
 
Linked lists
Linked listsLinked lists
Linked lists
 
Strategic autovacuum
Strategic autovacuumStrategic autovacuum
Strategic autovacuum
 
Basic ASM by @binaryheadache
Basic ASM by @binaryheadacheBasic ASM by @binaryheadache
Basic ASM by @binaryheadache
 
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
 
Call stack, event loop and async programming
Call stack, event loop and async programmingCall stack, event loop and async programming
Call stack, event loop and async programming
 
Perl Sucks - and what to do about it
Perl Sucks - and what to do about itPerl Sucks - and what to do about it
Perl Sucks - and what to do about it
 
OOUG: Oracle transaction locking
OOUG: Oracle transaction lockingOOUG: Oracle transaction locking
OOUG: Oracle transaction locking
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDD
 
Noinject
NoinjectNoinject
Noinject
 
Mona cheatsheet
Mona cheatsheetMona cheatsheet
Mona cheatsheet
 

Viewers also liked

Python学习笔记
Python学习笔记Python学习笔记
Python学习笔记Lingfei Kong
 
Beamer guide By KiJoo Kim (a.k.a. Daisyweb)
Beamer guide By KiJoo Kim (a.k.a. Daisyweb)Beamer guide By KiJoo Kim (a.k.a. Daisyweb)
Beamer guide By KiJoo Kim (a.k.a. Daisyweb)mustainmtn
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Lingfei Kong
 
It经典图书(附免费下载地址)
It经典图书(附免费下载地址)It经典图书(附免费下载地址)
It经典图书(附免费下载地址)Lingfei Kong
 
Emacs presentation
Emacs presentationEmacs presentation
Emacs presentationLingfei Kong
 

Viewers also liked (7)

Python学习笔记
Python学习笔记Python学习笔记
Python学习笔记
 
Beamer guide By KiJoo Kim (a.k.a. Daisyweb)
Beamer guide By KiJoo Kim (a.k.a. Daisyweb)Beamer guide By KiJoo Kim (a.k.a. Daisyweb)
Beamer guide By KiJoo Kim (a.k.a. Daisyweb)
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本
 
It经典图书(附免费下载地址)
It经典图书(附免费下载地址)It经典图书(附免费下载地址)
It经典图书(附免费下载地址)
 
Kdump
KdumpKdump
Kdump
 
Emacs presentation
Emacs presentationEmacs presentation
Emacs presentation
 
SR-IOV Introduce
SR-IOV IntroduceSR-IOV Introduce
SR-IOV Introduce
 

Similar to Congfigure python as_ide

我在豆瓣使用Emacs
我在豆瓣使用Emacs我在豆瓣使用Emacs
我在豆瓣使用Emacs董 伟明
 
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKMySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKYoungHeon (Roy) Kim
 
2005_Structures and functions of Makefile
2005_Structures and functions of Makefile2005_Structures and functions of Makefile
2005_Structures and functions of MakefileNakCheon Jung
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스PgDay.Seoul
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsPierre MARTIN
 
Composer, putting dependencies on the score
Composer, putting dependencies on the scoreComposer, putting dependencies on the score
Composer, putting dependencies on the scoreRafael Dohms
 
Extbase and Beyond
Extbase and BeyondExtbase and Beyond
Extbase and BeyondJochen Rau
 
start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()Kiwamu Okabe
 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with ExtbaseJochen Rau
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)David de Boer
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)David de Boer
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newYiwei Ma
 
Hello click click boom
Hello click click boomHello click click boom
Hello click click boomsymbian_mgl
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly LanguageMotaz Saad
 
Basicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt applicationBasicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt applicationDinesh Manajipet
 
Automated Spark Deployment With Declarative Infrastructure
Automated Spark Deployment With Declarative InfrastructureAutomated Spark Deployment With Declarative Infrastructure
Automated Spark Deployment With Declarative InfrastructureSpark Summit
 
とにかく始めるClojure
とにかく始めるClojureとにかく始めるClojure
とにかく始めるClojureMasayuki Muto
 

Similar to Congfigure python as_ide (20)

我在豆瓣使用Emacs
我在豆瓣使用Emacs我在豆瓣使用Emacs
我在豆瓣使用Emacs
 
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKMySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELK
 
2005_Structures and functions of Makefile
2005_Structures and functions of Makefile2005_Structures and functions of Makefile
2005_Structures and functions of Makefile
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
 
Composer, putting dependencies on the score
Composer, putting dependencies on the scoreComposer, putting dependencies on the score
Composer, putting dependencies on the score
 
Membrane protein-ligand tutorial with GROMACS.pdf
Membrane protein-ligand tutorial with GROMACS.pdfMembrane protein-ligand tutorial with GROMACS.pdf
Membrane protein-ligand tutorial with GROMACS.pdf
 
Extbase and Beyond
Extbase and BeyondExtbase and Beyond
Extbase and Beyond
 
start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()start_printf: dev/ic/com.c comstart()
start_printf: dev/ic/com.c comstart()
 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with Extbase
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
 
Hello click click boom
Hello click click boomHello click click boom
Hello click click boom
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly Language
 
Basicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt applicationBasicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt application
 
Automated Spark Deployment With Declarative Infrastructure
Automated Spark Deployment With Declarative InfrastructureAutomated Spark Deployment With Declarative Infrastructure
Automated Spark Deployment With Declarative Infrastructure
 
とにかく始めるClojure
とにかく始めるClojureとにかく始めるClojure
とにかく始めるClojure
 

Congfigure python as_ide

  • 1. Configure Emacs As a Python IDE Lingfei Kong 2014-11-10 Contents 1 My Emacs Configure 1 2 Emacs basic setting 1 3 Packages or plugins need to install (Configure emacs as a python IDE) 6 4 Install ECB 9 5 Set font for emacs (you can ignore this if you already have a satisfactory font) 11 6 Configure org-mode 12 7 Reference 14 1 My Emacs Configure slide 2 Emacs basic setting slide ;; .emacs ;; ============================== Basic Configure START ===================================== ;; set TAB=4 for C ;;(setq c-basic-offset 4) ;; ;; show colume number ;;(setq column-number-mode t) 1
  • 2. ;; kill the buffer imediate (global-set-key (kbd "C-x k") ’kill-this-buffer) ;; hide tool bar (tool-bar-mode -1) ;; hide menu bar (menu-bar-mode -1) ;;hide scroll bar (scroll-bar-mode -1) ;; (setq use-dialog-box nil) ;; (setq mouse-yank-at-point t) ;; Emacs (setq auto-image-file-mode t) ;;shelltelnetw3m, (add-hook ’comint-output-filter-functions ’comint-watch-for-password-prompt) ;;emacs (setq x-select-enable-clipboard t) ;; (setq mouse-yank-at-point t) ;;, (setq user-full-name "lkong") (setq user-mail-address "lkong@redhat.com") ;; (setq require-final-newline t) ;;F9Emacs (global-set-key [f9] ’calendar) 2
  • 3. ;;F10 (global-set-key [f10] ’list-bookmarks) ;; dired (setq dired-recursive-copies ’top) (setq dired-recursive-deletes ’top) ;;[C-f9]dired ;;(global-set-key [C-f9] ’dired) ;;control+spacemark (global-set-key (kbd "C-SPC") ’nil) ;; C-@ setmark , C-@ ;;(global-set-key (kbd "M-<SPC>") ’set-mark-command) (global-set-key [?S- ] ’set-mark-command) ;; (setq backup-directory-alist ’(("." . "~/emacs_backup"))) ;; ;;(setq make-backup-files nil) ;; (setq-default cursor-type ’bar) ;; ;; (setq-default cursor-type ’box) ;; “” (setq inhibit-startup-message t) ;; (transient-mark-mode t) ;; (setq mouse-wheel-mode t) ;; (setq column-number-mode t) 3
  • 4. ;; (global-linum-mode 1) ;; kill ring (setq kill-ring-max 200) ;; fill-column 60. (setq default-fill-column 60) ;; ;;(show-paren-mode t) ;;(setq show-paren-style ’parentheses) ;; buffer emacs@wangyin.com (setq frame-title-format "emacs@%b") ;; (put ’set-goal-column ’disabled nil) (put ’narrow-to-region ’disabled nil) (put ’upcase-region ’disabled nil) (put ’downcase-region ’disabled nil) (put ’LaTeX-hide-environment ’disabled nil) ;; dired (setq dired-recursive-copies ’top) (setq dired-recursive-deletes ’top) ;; auto enter new line (add-hook ’org-mode-hook (lambda () (setq truncate-lines nil))) ;; set key f11 to switch to full (global-set-key [f11] ’my-fullscreen) ;; full screen (fset ’yes-or-no-p’y-or-n-p) ;; statment highlight (global-font-lock-mode t) ;; use a large kill ring (setq kill-ring-max 1024) 4
  • 5. ;; Show the corse in which function (which-function-mode t) ;; set default tab width (setq default-tab-width 4) ;; do not use space to instead TAB (setq-default indent-tabs-mode t) ;; enable global line number ;;(global-linum-mode 1) ;;M-ggoto-line (global-set-key (kbd "M-g") ’goto-line) ;; No backup ;;(setq backup-inhibited t) (defun my-fullscreen () (interactive) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 ’(2 "_NET_WM_STATE_FULLSCREEN" 0)) ) ;; let emacs to max frame (add-to-list ’load-path "~/.emacs.d/elpa/maxframe-20120725.639/") (require ’maxframe) (add-hook ’window-setup-hook ’maximize-frame t) ;;#yum install wqy-microhei-fonts.noarch first ;;(set-default-font "WenQuanYi Micro Hei Mono-19.5") (set-default-font "WenQuanYi Zen Hei Mono-25") ;;(set-fontset-font (frame-parameter nil ’font) ’han "WenQuanYi Zen Hei Mono-24") ;;(set-fontset-font (frame-parameter nil ’font) ’gb18030 "WenQuanYi Zen Hei Mono-24") ;;(set-fontset-font (frame-parameter nil ’font) ’bopomofo "WenQuanYi Zen Hei Mono-24") ;;(set-fontset-font (frame-parameter nil ’font) ’cjk-misc "WenQuanYi Zen Hei Mono-24") ;;(set-fontset-font (frame-parameter nil ’font) ’nil "WenQuanYi Zen Hei Mono-24") ;;(set-fontset-font (frame-parameter nil ’font) ’symbol "WenQuanYi Zen Hei Mono-24") ;;(set-fontset-font (frame-parameter nil ’font) ’kana "WenQuanYi Micro Hei Mono-24") 5
  • 6. ;; ============================== Basic Configure END ====================================== 3 Packages or plugins need to install (Configure emacs as a python IDE) slide • Use yum to install packages in linux yum install packagename • Use list-packages or package-list-packages to install plugins in emacs You need first configure your package archives like: (setq package-archives ’(("gnu" . "http://elpa.gnu.org/packages/") ("marmalade" . "http://marmalade-repo.org/packages/") ("melpa" . "http://melpa.milkbox.net/packages/"))) • Packages need to install – YASnippet * Install yasnippet via list-packages Here is a link about list-packages: packages installation in emasc * Add configure for yasippet in .emacs (add-to-list ’load-path "~/.emacs.d/elpa/yasnippet-0.8.0/") (require ’yasnippet) (yas-global-mode 1) – auto-completion * Install auto-completion via list-packages * Add configure for auto-completion in .emacs 6
  • 7. (add-to-list ’load-path "~/.emacs.d/elpa/popup-20140815.629/") (require ’popup) (add-to-list ’load-path "~/.emacs.d/elpa/auto-complete-20140824.1658/") (require ’auto-complete-config) (add-to-list ’ac-dictionary-directories "~/.emacs.d/elpa/auto-complete-20140824.1658/(ac-config-default) – python-mode * Install python-mode via list-packages * Add configure for python-mode in .emacs (add-to-list ’load-path "~/.emacs.d/elpa/python-mode-6.1.3") (require ’python-mode) – ipython * Install ipython via yum install * Install ipython plugin via list-packages * Add configure for ipython in .emacs (add-to-list ’load-path "~/.emacs.d/elpa/ipython-2927/") (require ’ipython) – python document * Download pylookup from pylookup (this link is a git repo) You may download it to ~/.emacs.d/ * Download the newest python html document from python document download it to ~/.emacs.d/pylookup/ * ./pylookup.py -u python-2.7.1-docs-html to generate py-lookup. db 7
  • 8. * cp pylookup.py, pylookup.db, pylookup.el to ~/.emacs.d/plugins/pylookup * Add configure for python document in .emacs (setq pylookup-dir "~/.emacs.d/plugins/pylookup") (add-to-list ’load-path pylookup-dir) (require ’pylookup) ;; load pylookup when compile time (setq pylookup-program (concat pylookup-dir "/pylookup.py")) (setq pylookup-db-file (concat pylookup-dir "/pylookup.db")) ;; set search option if you want (setq pylookup-search-options ’("--insensitive" "0" "--desc" "0")) ;; to speedup, just load it on demand (autoload ’pylookup-lookup "pylookup" "Lookup SEARCH-TERM in the Python HTML indexes." t) (autoload ’pylookup-update "pylookup" "Run pylookup-update and create the database at ‘pylookup-db-file’." (global-set-key "C-ch" ’pylookup-lookup) (setq browse-url-browser-function ’w3m-browse-url) * Install w3m via yum install * Install w3m via list-packages – anything – pylint * Install pylint via ‘yum install pylint‘ * Install pylint via list-packages * Add configure for pylint in .emacs 8
  • 9. (add-to-list ’load-path "~/.emacs.d/elpa/pylint-20140729.1117/") (require ’pylint) – pep8 * Install pep8 via ‘easy_install pep8‘ * Install pep8 via list-packages * Add configure for pep8 in .emacs (add-to-list ’load-path "~/.emacs.d/elpa/pep8-1.2/") (require ’pep8) (require ’tramp) (add-hook ’before-save-hook ’delete-trailing-whitespace) – xcscope * Install cscope via ‘yum install cscope‘ * Install xcscope via list-packages * Add configure for xcscope in .emacs (add-to-list ’load-path "~/.emacs.d/elpa/xcscope-20140510.1437") (require ’xcscope) 4 Install ECB slide • Install ecb via list-packages • Add configure for ecb in .emacs (add-to-list ’load-path "~/.emacs.d/elpa/ecb-20140215.114/") (setq ecb-tip-of-the-day nil) (require ’ecb) (require ’ecb-autoloads) (setq ecb-auto-activate t) 9
  • 10. (global-set-key [M-left] ’windmove-left) (global-set-key [M-right] ’windmove-right) (global-set-key [M-up] ’windmove-up) (global-set-key [M-down] ’windmove-down) (define-key global-map [(control f1)] ’ecb-hide-ecb-windows) (define-key global-map [(control f2)] ’ecb-show-ecb-windows) ;;(define-key global-map [(control f3)] ’ecb-change-layout "left2") ;;(define-key global-map [(control f3)] ’ecb-change-layout) ;;(define-key global-map "C-c3" ’ecb-change-layout) (define-key global-map "C-c1" ’ecb-maximize-window-directories) (define-key global-map "C-c2" ’ecb-maximize-window-sources) (define-key global-map "C-c3" ’ecb-maximize-window-methods) (define-key global-map "C-c4" ’ecb-maximize-window-history) (define-key global-map "C-c‘" ’ecb-restore-default-window-sizes) (global-set-key [f12] ’ecb-activate) ;; ecb activate ;;(define-key global-map "C-c1" ’ecb-maximize-window-methods) ;;(define-key global-map "C-c2" ’ecb-maximize-window-history) ;;(define-key global-map "C-c‘" ’ecb-restore-window-sizes) ;; Disable buckets so that history buffer can display more entries (setq ecb-history-make-buckets ’never) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won’t work right. ’(ecb-create-layout-frame-height 10) ’(ecb-create-layout-frame-width 50) ’(ecb-layout-name "lkong") ’(ecb-layout-window-sizes nil) ’(ecb-options-version "2.40") ’(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2)) ’(ecb-toggle-layout-sequence (quote ("lkong2" "lkong"))) ’(ecb-windows-width 0.225)) ;;ecbTip 10
  • 11. (set-foreground-color "grey") (set-background-color "black") ;;(setq ecb-layout-name "left10") (setq ecb-history-make-buckets ’never) (setq ecb-fix-window-size t) (ecb-activate) ;; Ecb: ;; C-c . g d ;; C-c . g s ;; C-c . g m ;; C-c . g h ;; C-c . g l ;; C-c . g 1 1 ;; C-c . g n n ;; C-c . l c ;; C-c . l r ;; C-c . l t switch layout ;; C-c . l w ecb ;; C-c . / ;; C-c . e: jump to the eshell buffer ;; C-c . n: histroy back ;; C-c . p: histroy forwad ;; C-c .h: Show ECB help pager ;; left2: directory + source ;; left6: source + method + history ;; left8: directory + source + method + history – You may create your own layout via ’ecb-create-new-layout’, just follow the prompt 5 Set font for emacs (you can ignore this if you already have a satisfactory font) slide • Install wqy font yum -y install wqy-zenhei-fonts.noarch 11
  • 12. yum -y install wqy-microhei-fonts.noarch yum -y install wqy-bitmap-fonts.noarch • fc-cache • fc-list |grep wqy • Add configre for wqy font in .emacs (set-default-font "WenQuanYi Zen Hei Mono-24") 6 Configure org-mode slide In emacs24 org-mode is installed by default, if not you should install the following packages: • Install org via list-packages • Install emacs-common via yum install ;; ============================ Org-mode Configure START ================================= (require ’org-install) (require ’org-publish) (add-to-list ’auto-mode-alist ’(".org’" . org-mode)) (add-hook ’org-mode-hook ’turn-on-font-lock) (add-hook ’org-mode-hook (lambda () (setq truncate-lines nil))) (global-set-key "C-cl" ’org-store-link) (global-set-key "C-ca" ’org-agenda) (global-set-key "C-cb" ’org-iswitchb) ;;(global-set-key "C-cc" ’org-capture) (global-set-key "C-cc" ’org-remember) (add-to-list ’auto-mode-alist ’(".org’" . org-mode)) 12
  • 13. ;; GTD -- start (setq org-todo-keywords (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)") (sequence "SOMEDAY(s@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)")))) (setq org-todo-keyword-faces (quote (("TODO" :foreground "red" :weight bold) ("NEXT" :foreground "blue" :weight bold) ("DONE" :foreground "forest green" :weight bold) ("SOMEDAY" :foreground "orange" :weight bold) ("HOLD" :foreground "magenta" :weight bold) ("CANCELLED" :foreground "forest green" :weight bold)))) (setq org-todo-state-tags-triggers (quote (("CANCELLED" ("CANCELLED" . t)) ("SOMEDAY" ("SOMEDAY" . t)) ("HOLD" ("SOMEDAY" . t) ("HOLD" . t)) (done ("SOMEDAY") ("HOLD")) ("TODO" ("SOMEDAY") ("CANCELLED") ("HOLD")) ("NEXT" ("SOMEDAY") ("CANCELLED") ("HOLD")) ("DONE" ("SOMEDAY") ("CANCELLED") ("HOLD"))))) (setq org-directory "~/Org-mode") (global-set-key (kbd "C-c c") ’org-capture) (setq org-capture-templates (quote (("t" "todo" entry (file "~/Org-mode/todo.org") "* TODO %?n%an" :clock-in t :clock-resume t) ("i" "idea" entry (file+datetree "~/Org-mode/idea.org") "* %? n") ("s" "someday" entry (file "~/Org-mode/someday.org") "* SOMEDAY %? :SOMEDAY:n%an" :clock-in t :clock-resume t) ("n" "note" entry (file "~/Org-mode/diary.org") "* %? :NOTE:n%an" :clock-in t :clock-resume t) ("w" "org-protocol" entry (file "~/Org-mode/refile.org") "* TODO Review %cn%Un" :immediate-finish t)))) ;;(setq org-tag-alist ’(("office" . ?o) ("home" . ?h) ("notes" . ?n) ("slide" . ?s))) ;; GTD -- end ;; Only show the last star 13
  • 14. ;;(setq org-hide-leading-stars t) ;;org mode (add-to-list ’auto-mode-alist ’(".org’" . org-mode)) (add-hook ’org-mode-hook ’turn-on-font-lock) (add-hook ’org-mode-hook (lambda () (setq truncate-lines nil))) ;; Remove empty LOGBOOK drawers on clock out (defun bh/remove-empty-drawer-on-clock-out () (interactive) (save-excursion (beginning-of-line 0) (org-remove-empty-drawer-at "LOGBOOK" (point)))) (add-hook ’org-clock-out-hook ’bh/remove-empty-drawer-on-clock-out ’append) (defun gtd () (interactive) (find-file "~/Org-mode/todo.org") ) (global-set-key (kbd "<f12>") ’list-bookmarks) (defun insert-current-time () "Insert the current time" (interactive "*") ;;(insert (format-time-string "%Y/%m/%d %H:%M:%S" (current-time)))) (insert (format-time-string "%Y-%m-%d" (current-time)))) ;;(insert (format-time-string "%H:%M:%S" (current-time)))) (global-set-key "C-xt" ’insert-current-time) ;; ============================ Org-mode Configure END ================================= 7 Reference slide • Configure python as a IDE 14