color-theme のインストールと設定
(CarbonEmacs & NTEmacs)

color-theme は、Emacs の face を色々とカスタマイズするのを手助けしてくれます。

  1. まえがき
  2. インストール
  3. 設定
  4. 使いかた

関連するページはこちら、

MacOSX & Cygwin on Windows のソフトの事

CarbonEmacs と、NTEmacs のページは此方


1. まえがき

color-theme は、Emacs の face をカスタマイズするのを手助けしてくれます。色々な、カスタマイズ例も、含まれています。

http://www.cs.cmu.edu/~maverick/GNUEmacsColorThemeTest/ に、例が紹介されています。


2. インストール

2.1. References

Homepage
https://gna.org/projects/color-theme http://www.emacswiki.org/cgi-bin/wiki?ColorTheme
Source
http://download.gna.org/color-theme/
cvs
cvs -d:pserver:anonymous@cvs.gna.org:/cvs/color-theme co color-theme

cvs の方が良いかもしれない。


2.3. patch

現在取得できる物は、stable も、cvs先端も、以下の問題があります。

ので、下のパッチをあてます。

--- ../color-theme.orig/color-theme.el	2006-07-06 13:45:45.000000000 +0900
+++ color-theme.el	2006-12-03 09:50:38.000000000 +0900
@@ -50,7 +50,7 @@
   (require 'reporter)
   (require 'sendmail))

-(require 'cl); set-difference is a function...
+;; (require 'cl); set-difference is a function...

 ;; for custom-face-attributes-get or face-custom-attributes-get
 (require 'cus-face)
@@ -73,8 +73,8 @@
   "Non-nil if running XEmacs.")

 ;; Add this since it appears to miss in emacs-2x
-(or (fboundp 'replace-in-string)
-    (defun replace-in-string (target old new)
+(or (fboundp 'color-theme-replace-in-string)
+    (defun color-theme-replace-in-string (target old new)
       (replace-regexp-in-string old new  target)))

 ;; face-attr-construct has a problem in Emacs 20.7 and older when
@@ -639,7 +639,7 @@
 This makes sure that SPEC has the form ((t (PLIST ...))).
 Only properties not in `color-theme-illegal-default-attributes'
 are included in the SPEC returned."
-  (let ((props (cadar spec))
+  (let ((props (car (cdr (car spec))))
 	result prop val)
     (while props
       (setq prop (nth 0 props)
@@ -688,7 +688,7 @@
 function replaces a :bold attribute with the corresponding :weight
 attribute, if there is no :weight, or deletes it.  This undoes the
 doings of `color-theme-spec-canonical-font', more or less."
-    (let ((props (cadar spec)))
+    (let ((props (car (cdr (car spec)))))
       (when (plist-member props :bold)
 	(setq props (color-theme-plist-delete props :bold))
 	(unless (plist-member props :weight)
@@ -1149,7 +1149,7 @@
   ;; people.  These *must* use a larger font in order to be usable.
   (let (result)
     (dolist (face faces)
-      (let ((props (cadar (nth 1 face))))
+      (let ((props (car (cdr (car (nth 1 face))))))
 	(if (and (plist-member props :height)
 		 (integerp (plist-get props :height)))
 	    (setq props (color-theme-plist-delete props :height)
@@ -1628,8 +1628,8 @@
        (add-to-list 'color-themes
                     (list ',n
                           (upcase-initials
-                           (replace-in-string
-                            (replace-in-string
+                           (color-theme-replace-in-string
+                            (color-theme-replace-in-string
                              (symbol-name ',n) "^color-theme-" "") "-" " "))
                           ,author))
        (defun ,n ()

2.3. make & install

2.3.1. Mac OSX

先ずは、Makefile.defs を編集

EMACS    = /Applications/Emacs.app/Contents/MacOS/Emacs
PREFIX   = /Applications/Emacs.app/Contents/Resources/share/emacs
ELISPDIR = $(PREFIX)/site-lisp/color-theme-el
INFODIR  = $(PREFIX)/info

何故か、byte-compile するのに、load-path の、color-theme を load しにいくので、

$ sudo mkdir /Applications/Emacs.app/Contents/Resources/share/emacs/site-lisp/color-theme-el
$ sudo cp color-theme.el /Applications/Emacs.app/Contents/Resources/share/emacs/site-lisp/color-theme-el

しておいてから、

$ make
$ sudo make install

2.3.2. Cygwin

先ずは、Makefile.defs を編集

EMACS    = /usr/local/emacs/22.0.90/bin/emacs.exe
PREFIX   = /usr/local/emacs
ELISPDIR = $(PREFIX)/site-lisp/color-theme-el
INFODIR  = $(PREFIX)/info

何故か、byte-compile するのに、load-path の、color-theme を load しにいくので、

$ mkdir /usr/local/emacs/site-lisp/color-theme-el
$ cp color-theme.el /usr/local/emacs/site-lisp/color-theme-el

しておいてから、

$ make
$ make install

3. 設定

では、.emacs の設定です。2


3.1. 読み込み

私は、color-theme-arjen をつかっています。

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

(color-theme-arjen)

3.2. カスタマイズ

一寸読みにくいので、カスタマイズ

(defun color-theme-myarjen ()
  "Color theme by awiersma, created 2001-08-27."
  (interactive)
  (color-theme-install
   '(color-theme-myarjen
     ()
     (bold-italic ((t (:bold t :slant italic))))
     (fl-comment-face ((t (:foreground "gold"))))
     (font-lock-comment-face ((t (:foreground "gold"))))
     (gnus-cite-face-1 ((t (:bold t :foreground "deep sky blue"))))
     (gnus-cite-face-2 ((t (:bold t :foreground "cadetblue"))))
     (gnus-cite-face-3 ((t (:bold t :foreground "gold"))))
     (gnus-cite-face-6 ((t (:bold t :foreground "chocolate"))))
     (gnus-emphasis-bold ((t (:bold t))))
     (gnus-emphasis-bold-italic ((t (:slant italic :bold t))))
     (gnus-emphasis-italic ((t (:slant italic))))
     (gnus-emphasis-underline-bold ((t (:underline t :bold t))))
     (gnus-emphasis-underline-bold-italic ((t (:slant italic :underline t :bold t))))
     (gnus-emphasis-underline-italic ((t (:slant italic :underline t))))
     (gnus-group-mail-1-face ((t (:bold t :foreground "aquamarine1"))))
     (gnus-group-mail-2-face ((t (:bold t :foreground "aquamarine2"))))
     (gnus-group-mail-3-face ((t (:bold t :foreground "aquamarine3"))))
     (gnus-group-mail-low-face ((t (:bold t :foreground "aquamarine4"))))
     (gnus-group-news-1-face ((t (:bold t :foreground "PaleTurquoise"))))
     (gnus-group-news-2-face ((t (:bold t :foreground "turquoise"))))
     (gnus-group-news-3-face ((t (:bold t))))
     (gnus-group-news-4-face ((t (:bold t))))
     (gnus-group-news-5-face ((t (:bold t))))
     (gnus-group-news-6-face ((t (:bold t))))
     (gnus-group-news-low-face ((t (:bold t :foreground "DarkTurquoise"))))
     (gnus-header-from-face ((t (:bold t :foreground "spring green"))))
     (gnus-header-newsgroups-face ((t (:bold t :foreground "purple"))))
     (gnus-header-subject-face ((t (:bold t :foreground "orange"))))
     (italic ((t (:slant italic))))
     (woman-bold-face ((t (:bold t :foreground "yellow"))))
     (woman-italic-face ((t (:slant italic :foreground "cyan")))))))

(color-theme-myarjen)

4. 使いかた

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

しておいて、

M-x color-theme-select

すると、対話的に、色々なテーマを試す事が出来ます。


1. (require 'cl) の問題に関しては、http://lists.sourceforge.jp/mailman/archives/macemacsjp-users/2005-August/000560.html 以下のスレッドを参照ください。

2. 実際には、メンテし易いように、~/.emacs/.color-theme.el として、~/.emacs.el から、読みこんでいます。