2007年8月11日 星期六

Ubuntu - Emacs Colortheme





原來我漏看了東西,以為只要把 colortheme.el 等檔案放到 ~/.emacs.d/ 裡頭就可以了,沒想到 Debian/Ubuntu 底下是沒辦法這樣用,要自己新增 loadpath,EmacsWiki 如是說:
The directory ~/.emacs.d/ is a standard location for your own configuration files, your own developments, or external third-party modes, but is not shipped by the operating system distributor--Debian for example--in contrast with what configurations are allowed to a user’s DotEmacs.
設定 loadpath 的方法為,請編輯 ~/.emacs ,並新增下列設定:

(add-to-list 'load-path (expand-file-name "~/.emacs.d/"))

這樣在 Debian/Ubuntu 上也可以使用 ~/.emacs.d/ 為 loadpath 了。接下來設定 colortheme ,到 http://download.gna.org/color-theme/ 下載,接著把 color-theme.elthemes 資料夾搬到 ~/.emacs.d/:

$ wget http://download.gna.org/color-theme/color-theme-6.6.0.tar.gz
$ tar xvf color-theme-6.6.0.tar.gz
$ cd color-theme-6.6.0
$ mv color-theme.el themes ~/.emacs.d/


接著 ~/.emacs 也請加上:

(require 'color-theme)
(color-theme-initialize)

接著 M-x color-theme-select 就可以選了,有喜歡的就在 ~/.emacs 內新增,譬如:

(color-theme-midnight)

重開完工。 Orz

[1] http://www.emacswiki.org/cgi-bin/wiki?ColorTheme
[2] http://www.emacswiki.org/cgi-bin/wiki/DotEmacsDotD#.emacs.d