Color Theme Darkmate for Emacs

Dylan.Wen posted @ 2010年2月28日 19:34 in Emacs with tags emacs color-theme DarkMate , 3647 阅读

Color Theme is an Emacs-Lisp package for making Emacs colorful and beautiful. It is popularly used among Emacsers, including me. When I use it and try to fontify Emacs as the font-lock facilities do, I found there is a bug in the Color Theme latest version 6.6.0 package.
Line 689 of the source file "color-theme.el", in the defination of function "color-theme-spec-compat", it uses "cadar" to fetch out the property of only the first element of face specification, rather than fetch out the whole specification. So give the face specification as

      ((((class color) (min-colors 88)) (:foreground "red"))
       (((class color) (min-colors 16)) (:foreground "green"))
       (((class color) (min-colors 8)) (:foreground "blue"))
       (((type tty) (class mono)) (:foreground "white"))
       (t (:foreground "red"))))

It is a correct face specification(refer to macro `defface' for more information of face specification), and "dired-mark" should be in color "green" under 16-color environment and "blue" under 8-color environment. However function "color-theme-spec-compat" just set "dired-mark" to be "red" in any case. It reduces the flexibility of face-lock facilities of Emacs when using Color Theme.

To fix this, I revise the defination of "color-theme-spec-compat" like

(defun color-theme-spec-compat (spec)
  "An redifination of `color-theme-spec-compat' of `color-theme'.
To apply different face settings according to different term types."
  (let (compat-spec props)
    (dolist (dis-atts spec)
      (setq props (cadr dis-atts))
      (when (plist-member props :bold)
        (setq props (color-theme-plist-delete props :bold))
        (unless (plist-member props :weight)
          (setq props (plist-put props :weight 'bold))))
      (when (plist-member props :italic)
        (setq props (color-theme-plist-delete props :italic))
        (unless (plist-member props :slant)
          (setq props (plist-put props :slant 'italic))))
      (setcdr dis-atts `(,props))
      (add-to-list 'compat-spec dis-atts 'APPEND))

and put this into the file "color-theme+.el".

I give a try out to customize a color-theme of my favour as well. I name it "color-theme-darkmate". This color theme is inspired by the theme darkmate of gEdit, which is a color theme somewhat similar with the theme of editor TextMate on Mac. I never use the editor TextMate before and don't know how much does "color-theme-darkmate" look like the theme TextMate. The settings in "color-theme-darkmate.el" is created in the opinion of using a few elementary colors as consistantly as possible in various modes to make a colorful and eye candy Emacs.

You could download "color-theme+.el" and "color-theme-darkmate.el" here.