系統(tǒng): ubuntu 7.10
我現(xiàn)在2臺機上在用這個版本,一臺機是gnome, 另一臺機是KDE,KDE上的emacs-gtk可以直接用scim輸入了,但gnome據(jù)說是某session-daemon程序的問題導(dǎo)致不能激活外部輸入法,我現(xiàn)在的解決方法是開一個terminal, 在terminal下用emacs -nw啟動,這樣就能用外部輸入法輸入中文了
Checkout源代碼
sudo apt-get install ssh cvs
export CVS_RSH="ssh"
cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/cvsroot/emacs co -r emacs-unicode-2 emacs
安裝依賴包
sudo apt-get install texinfo libgpmg1-dev libungif4-dev libpng12-dev libgd2-xpm-dev libtiff4-dev libjpeg62-dev librsvg2-dev libgtk2.0-dev
注意:上面有幾個圖形庫不是必須的;我的機器本來就裝了很多開發(fā)庫,所以上面的庫估計也是不全的
編譯安裝
./configure --prefix=/usr --enable-font-backend --with-gtk --with-xft --with-freetype && make bootstrap && make info && sudo make install
配置
編輯~/.Xresources
Xft.antialias: 1
# 可以嘗試把hinting關(guān)了對比效果,有些顯示器上不開反而更好看
Xft.hinting: 1
Xft.hintstyle: hintfull
Xft.rgba: rgb
Emacs.FontBackend: xft
Emacs.Geometry: 100x32+4+4
執(zhí)行xrdb ~/.Xresources例配置生效
編輯~/.emacs文件(最新版在我的
wiki)
;;設(shè)置個人信息
;;
(setq user-full-name "Jarod Liu")
(setq user-mail-address "liuyuanzhi(at)gmail.com")
;;添加自定義loadpath
;;
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(let* ((my-lisp-dir "/home/jarod/.myemacs/")
(default-directory my-lisp-dir))
(setq load-path (cons my-lisp-dir load-path))
(normal-top-level-add-subdirs-to-load-path)))
;;設(shè)置字體
;;
(set-default-font "Monospace-14")
(set-fontset-font (frame-parameter nil 'font)
'unicode '("Microsoft YaHei" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
'han '("Microsoft YaHei" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
'symbol '("Microsoft YaHei" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
'cjk-misc '("Microsoft YaHei" . "unicode-bmp"))
(set-fontset-font (frame-parameter nil 'font)
'bopomofo '("Microsoft YaHei" . "unicode-bmp"))
;; For my language code setting (UTF-8)
;;
(setq current-language-environment "UTF-8")
(setq default-input-method "chinese-py")
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
;;啟動服務(wù)器(for emacsclient)
;;
(server-start)
;;自定義按鍵
;;
(global-set-key [f1] 'shell);F1進入Shell
;(global-set-key (kbd "C-SPC") 'nil);用win+space為set-mark鍵,留出ctrl+space熱鍵作為輸入法
;(global-set-key (kbd "S-SPC") 'set-mark-command)
;;使用習(xí)慣配制
;;
(setq default-major-mode 'text-mode);一打開就起用 text 模式。
(global-font-lock-mode t);語法高亮
(auto-image-file-mode t);打開圖片顯示功能
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no
(setq default-fill-column 80);默認顯示 xx列就換行
(column-number-mode t);顯示列號
(show-paren-mode t);顯示括號匹配
(setq show-paren-style 'parentheses);括號匹配時顯示另外一邊的括號,而不是跳到另一個括號
;(display-time-mode 1);顯示時間,格式如下
;(setq display-time-24hr-format t)
;(setq display-time-day-and-date t)
(tool-bar-mode nil);去掉工具欄
(scroll-bar-mode nil);去掉滾動條,可以使用鼠標(biāo)滾輪
(setq scroll-margin 3 scroll-conservatively 10000);防止頁面滾動時跳動, scroll-margin 3 可以在靠近屏幕邊沿3行時就開始滾動
(mouse-avoidance-mode 'animate);光標(biāo)靠近鼠標(biāo)指針時,讓鼠標(biāo)指針自動讓開
(setq mouse-yank-at-point t);支持中鍵粘貼
(transient-mark-mode t);高亮顯示要拷貝的區(qū)域
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘貼
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value) ;
(setq frame-title-format "%b");在標(biāo)題欄提示buffer名
(setq-default make-backup-files nil);不要生成臨時文件
(setq visible-bell t);關(guān)閉煩人的出錯時的提示聲
(setq inhibit-startup-message t);關(guān)閉起動時的那個“開機畫面”
(setq kill-ring-max 64);undo number
;; 縮進
(setq default-tab-width 4);; 設(shè)置tab為4個空格的寬度
(setq tab-width 4)
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key "\C-j" 'newline);; 交換這兩個按鍵。因為大多數(shù)情況下,回車后是要縮進的。
;; mode alist
(mapcar
(function (lambda (setting)
(setq auto-mode-alist
(cons setting auto-mode-alist))))
'(("\\.xml$". sgml-mode)
("\\\.bash" . sh-mode)
("\\.rdf$". sgml-mode)
("\\.session" . emacs-lisp-mode)
("\\.l$" . c-mode)
("\\.css$" . css-mode)
("\\.cfm$" . html-mode)
("gnus" . emacs-lisp-mode)
("\\.idl$" . idl-mode)
("\\.rb$" . ruby-mode)
("\\.rhtml$" . html-mode)))
;; tabbar
;;
(require 'tabbar) ; http://liuyuanzhi.googlepages.com/tabbar.el
(tabbar-mode)
;(global-set-key (kbd "") 'tabbar-backward-group)
;(global-set-key (kbd "") 'tabbar-forward-group)
(global-set-key (kbd "C-`") 'tabbar-backward) ;切換TAB的快捷鍵
(global-set-key (kbd "C-<tab>") 'tabbar-forward)
;(set-face-attribute 'tabbar-default-face nil :family "Tahoma") ;設(shè)置tabbar字體
;; color-theme
;;
(require 'color-theme) ;http://liuyuanzhi.googlepages.com/color-theme.el
(color-theme-gnome2)
;; ruby
;; based on http://www.rubygarden.org/Ruby/page/show/InstallingEmacsExtensions
;;
(require 'ruby-mode) ;安裝ubuntu中的ruby-elisp包
(autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t)
(modify-coding-system-alist 'file "\\.rb$" 'utf-8)
(modify-coding-system-alist 'file "\\.rhtml$" 'utf-8)
(autoload 'run-ruby "inf-ruby"
"Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
'(lambda ()
(inf-ruby-keys)))
;; If you have Emacs 19.2x or older, use rubydb2x
(autoload 'rubydb "rubydb3x" "Ruby debugger" t)
配置文件都是從網(wǎng)上直接copy來的,把一些不用的注釋了