通过yum的安装方式,安装的版本比较旧(好像是21版本,没有亲自确认)。小白喜欢用最新版的Emacs,所以就准备编译安装。
环境准备,
1 2 | 操作系统:CentOS6U5 64bit # CentOS7也是同样的操作 软件环境:Basic环境"Development Tools"环境 |
以下为安装步骤:
1.安装EPEL源
1 | rpm -ivh http: //mirrors .ustc.edu.cn /fedora/epel//6/x86_64/epel-release-6-8 .noarch.rpm |
2. 下载Emacs最新版本,这里使用的最新版本为24.5
3. 安装Emacs的依赖包
1 2 3 4 5 | # yum install -y ncurses-devel # ----------以下为非必须---------- # 如果在图形化界面下使用Emacs可以安装下面的几个包, # 主要目的是让Emacs可以显示图片 # yum install -y libpng-devel libjpeg-devel libtiff-devel |
4. 编译安装Emacs
1 2 3 4 5 6 7 | # cd /usr/local/src/ # tar -xf emacs-24.5.tar.gz # cd emacs-24.5 # ./configure # make # src/emacs -Q ; 测试make后的Emacs是否可用,非必须 # make install |
5. 准备配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | # cat ~/.emacs (global- set -key "\C-h" 'backward-delete-char-untabify) (global- set -key "\d" 'delete-char) ;; disable the startup info (setq inhibit-startup-message t) (setq-default tab-width 4) (setq fill-column 70) ;; Display settings (display- time -mode t) (column-number-mode t) ;; 高亮显示选中块 (transient-mark-mode t) ;; 支持外部复制粘贴 (setq x- select - enable -clipboard t) ;; Show the patern parentheses ;; 显示括号匹配 (show-paren-mode t) (setq show-paren-style 'parentheses) ;; multi windows settings ;;(require 'window-numbering) ;;(window-numbering-mode 1) ;; Time settings ;; 设置显示底边栏(时间,行列号),字体 ;; (setq display- time -day-and- date t) (display- time -mode 1) (setq display- time -24hr- format t) (setq display- time -use-mail-icon t) ;; 邮件设置图标 (setq frame-title- format "LavenLiu@%b" ) ;; GDB设置,多窗口GDB (setq gdb-many-windows t) ;; Syntax highlight (global-font-lock-mode t) ;; y|n represents yes |no ;; 设置用 'y' 或 'n' 代替 'yes' 或 'no' (fset 'yes-or-no-p ' y-or-n-p) ;;;; yasnippet setting (add-to-list 'load-path "~/.emacs.d/elpa/yasnippet" ) (require 'yasnippet) (yas /global-mode 1) ;; stop auto save (setq auto-save-default nil) (setq make -backup-files nil) ;; turn on ruler ;;(ruler-mode 1) ;;这两句是我的全局配置,避免出现多语言混乱。 ;; Encoding style ( set -buffer- file -coding-system 'utf-8) ( set default-buffer- file -coding-system 'utf-8) ( set -terminal-coding-system 'utf-8) ( set -language-environment 'UTF-8) ( set -locale-environment "UTF-8" ) ;; (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. '(ansi-color-faces-vector [default default default italic underline success warning error]) '(ansi-color-names-vector [ "black" "red3" "ForestGreen" "yellow3" "blue" "magenta3" "DeepSkyBlue" "gray50" ]) '(auto-image- file -mode t) '(auto-save-default nil) '(c-label-minimum-indentation 4) '(column-number-mode t) '(compile- command "gcc -g -o" ) '(current-language-environment "UTF-8" ) '(custom-enabled-themes (quote (light-blue))) '(display- time -mode t) '(ede-auto-add-method (quote always)) '(emms-lyrics-coding-system (quote gb2312)) '(emms-lyrics-display-buffer t) '(emms-lyrics-display-on-minibuffer t) '(emms-player-list (quote (emms-player-mpg321 emms-player-ogg123 emms-player-mplayer))) '(global-semantic-highlight-edits-mode t) '(global-semantic-highlight-func-mode t) '(global-semantic-idle-completions-mode t nil (semantic /idle )) '(image-animate-loop t) '(jde-jdk-registry (quote (( "1.7.0_75" . "/usr/lib/jdk1.7.0_75" )))) '( make -backup-files nil) '(mew-addrbook- file "~/Mail/Addrbook" ) '(mew-mail-domain "163.com" ) '(mew-name "xxxxxxxx" ) '(mew-smtp-server "smtp.163.com" ) '(mew-use-auto- alias t) '(mew-user "xxxxxxxx" ) '(org-agenda-files (quote ( "~/Desktop/iGTD/iGTD.org" ))) '(org-completion-use-ido t) '(org-modules (quote (org-bbdb org-bibtex org-ctags org-docview org-gnus org-info org-irc org-mhe org-rmail org-w3m org-eshell org-mew org-toc))) '(org-startup-with-inline-images t) '(org-use-fast-todo-selection t) '(package-archives (quote (( "gnu" . "http://elpa.gnu.org/packages/" ) ( "melpa" . "http://melpa.org/packages/" )))) '(safe- local -variable-values (quote ((TeX-master . t)))) '(semantic-default-submodes (quote (global-semantic-decoration-mode global-semantic-idle-completions-mode global-semantic-idle-scheduler-mode global-semanticdb-minor-mode global-semantic-idle-summary-mode global-semantic-mru-bookmark-mode))) '(semantic-idle-scheduler-idle- time 3) '(send-mail- function (quote smtpmail-send-it)) '(show-paren-mode t) '(smtpmail-smtp-server "smtp.163.com" ) '(smtpmail-smtp-service 25) '(vc-annotate-color-map (quote ((20 . "#ab4642" ) (50 . "#dc9656" ) (80 . "#f7ca88" ) (110 . "#a1b56c" ) (140 . "#86c1b9" ) (170 . "#7cafc2" ) (200 . "#ba8baf" ) (230 . "#a16046" ) (260 . "#181818" ) (290 . "#282828" ) (320 . "#383838" ) (350 . "#585858" )))) '(vc-annotate-very-old-color "#585858" )) (custom- set -faces ;; custom- set -faces 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. '(default ((t (:family #("新宋体" 0 3 (charset chinese-gbk)) :foundry "outline" :slant normal :weight normal :height 120 :width normal))))) ;; E-Mail settings (add-to-list 'load-path ( expand - file -name "~/.emacs.d/elpa/mew-20140901.1737/" )) (autoload 'mew "mew" nil t) (autoload 'mew-send "mew" nil t) ( if (boundp ' read -mail- command ) (setq read -mail- command 'mew)) (autoload 'mew-user-agent-compose "mew" nil t) ( if (boundp 'mail-user-agent) (setq mail-user-agent 'mew-user-agent)) ( if (fboundp 'define-mail-user-agent) (define-mail-user-agent 'mew-user-agent 'mew-user-agent-compose 'mew-draft-send-message 'mew-draft- kill 'mew-send-hook)) ;; Highlight the selected region (transient-mark-mode t) ;; 设置光标和指针颜色 ( set -cursor-color "red" ) ( set -mouse-color "goldenrod" ) ;; 设置选中区域的颜色 ( set -face-background 'region "yellow" ) ;; Add a blank line at the end of the file ;; 在文件末尾添加一空白行 (setq require-final-newline t) (setq track-eol t) (add-to-list 'load-path "~/.emacs.d/elpa/pde/lisp" ) (load "pde-load" ) ;; ditaa block for org mode (org-babel- do -load-languages 'org-babel-load-languages '((ditaa . t) ; this line activates ditaa (plantuml . t) ( awk . t) (python . t) (perl . t) (ruby . t) (R . t) (sh . t) (gnuplot . t) (org . t) (java . t) (emacs-lisp . t) (calc . t) (sql . t) (dot . t) )) (setq org-ditta-jar-path ( expand - file -name "~/.emacs.d/elpa/contrib/scripts/ditta.jar" )) (setq org-plantuml-jar-path ( expand - file -name "~/.emacs.d/elpa/contrib/scripts/plantuml.jar" )) ;; org mode do not prompt me (setq org-confirm-babel-evaluate nil) (setq org-src-fontify-natively t) ;; =============================================== ;; my own functions (defun gtd () (interactive) ( find - file "~/Desktop/iGTD/iGTD.org" ) ) ;; my own shortcuts (global- set -key "\C-cx" 'gtd) (global- set -key (kbd "M-g" ) 'goto-line) (global- set -key "\C-\\" ' set -mark- command ) (defun read -only- if - symlink () ( if ( file - symlink -p buffer- file -name) ((progn ) (setq buffer- read -only t) (message "File is a symlink" )))) (add-hook 'find-file-hook ' read -only- if - symlink ) (add-hook 'local-write-file-hooks ' update-writestamps) (defun update-writestamps () "Find writestamps and replace them with the current time." (save-excursion (save-restriction (save-match-data (widen) (goto-char (point-min)) ( while (search-forward "WRITESTAMP((" nil t) ( let ((start (point))) (search-forward "))" ) (delete-region start (- (point) 2)) (goto-char start) (insert- date )))))) nil) ;;; 自动补全设置 (add-to-list 'load-path "~/.emacs.d/elpa/auto-complete" ) (require 'auto-complete) ;;; Python的编程环境配置 (add-to-list 'load-path "~/.emacs.d/elpa/python-environment" ) (add-to-list 'load-path "~/.emacs.d/elpa/jedi" ) (add-to-list 'load-path "~/.emacs.d/elpa/jedi-core" ) (add-to-list 'load-path "~/.emacs.d/elpa/virtualenv" ) (add-to-list 'load-path "~/.emacs.d/elpa/ctable" ) (add-to-list 'load-path "~/.emacs.d/elpa/concurrent" ) (add-to-list 'load-path "~/.emacs.d/elpa/deferred" ) (add-to-list 'load-path "~/.emacs.d/elpa/epc" ) (add-to-list 'load-path "~/.emacs.d/elpa/popup" ) (require 'popup) (require 'ctable) (require 'concurrent) (require 'epc) (add-hook 'python-mode-hook ' jedi:setup) (autoload 'jedi:setup "jedi" nil t) (setq jedi:complete-on-dot t) (require 'cedet) (global-ede-mode 1) ;; My Own settings ;; easy keys for split windows (global- set -key (kbd "M-3" ) 'delete-other-windows) ; [Alt+] unsplit all (global- set -key (kbd "M-4" ) ' split -window-below) (global- set -key (kbd "M-$" ) ' split -window-right) (global- set -key (kbd "M-RET" ) 'other-window) ; [Alt+Return] move cursor to next pane (global- set -key (kbd "M-0" ) 'delete-window) ; remove current pane |
6. 把.emacs.d目录放置到当前用户的家目录
7. 安装与Python相关的依赖包jedi
1 2 3 4 | yum install -y python-pip pip install ecdsa pip install epc pip install jedi |
以上几个步骤,已经完成Emacs的安装及Python编程环境的配置,接下来Enjoy!