thirdparty/color-theme.el
author Luke Hoersten <Luke@Hoersten.org>
Mon, 13 Feb 2012 12:46:18 -0600
changeset 47 3415a60d5fd0
parent 46 2c6b198426df
permissions -rw-r--r--
Added solarized color theme.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     1
;;; color-theme.el --- install color themes
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     2
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     3
;; Copyright (C) 1999, 2000  Jonadab the Unsightly One <[email protected]>
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     4
;; Copyright (C) 2000, 2001, 2002, 2003  Alex Schroeder <[email protected]>
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     5
;; Copyright (C) 2003, 2004, 2005, 2006  Xavier Maillard <[email protected]>
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     6
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     7
;; Version: 6.6.0
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     8
;; Keywords: faces
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
     9
;; Author: Jonadab the Unsightly One <[email protected]>
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    10
;; Maintainer: Xavier Maillard <[email protected]>
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    11
;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ColorTheme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    12
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    13
;; This file is not (YET) part of GNU Emacs.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    14
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    15
;; This is free software; you can redistribute it and/or modify it under
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    16
;; the terms of the GNU General Public License as published by the Free
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    17
;; Software Foundation; either version 2, or (at your option) any later
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    18
;; version.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    19
;;
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    20
;; This is distributed in the hope that it will be useful, but WITHOUT
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    21
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    22
;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    23
;; for more details.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    24
;;
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    25
;; You should have received a copy of the GNU General Public License
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    26
;; along with GNU Emacs; see the file COPYING.  If not, write to the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    27
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    28
;; MA 02111-1307, USA.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    29
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    30
;;; Commentary:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    31
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    32
;; Please read README and BUGS files for any relevant help.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    33
;; Contributors (not themers) should also read HACKING file.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    34
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    35
;;; Thanks
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    36
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    37
;; Deepak Goel  <[email protected]>
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    38
;; S. Pokrovsky <[email protected]> for ideas and discussion.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    39
;; Gordon Messmer <[email protected]> for ideas and discussion.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    40
;; Sriram Karra <[email protected]> for the color-theme-submit stuff.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    41
;; Olgierd `Kingsajz' Ziolko <[email protected]> for the spec-filter idea.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    42
;; Brian Palmer for color-theme-library ideas and code
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    43
;; All the users that contributed their color themes.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    44
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    45
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    46
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    47
;;; Code:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    48
(eval-when-compile
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    49
  (require 'easymenu)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    50
  (require 'reporter)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    51
  (require 'sendmail))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    52
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    53
(require 'cl); set-difference is a function...
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    54
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    55
;; for custom-face-attributes-get or face-custom-attributes-get
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    56
(require 'cus-face)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    57
(require 'wid-edit); for widget-apply stuff in cus-face.el
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    58
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    59
(defconst color-theme-maintainer-address "[email protected]"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    60
  "Address used by `submit-color-theme'.")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    61
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    62
;; Emacs / XEmacs compatibility and workaround layer
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    63
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    64
(cond ((and (facep 'tool-bar)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    65
	    (not (facep 'toolbar)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    66
       (put 'toolbar 'face-alias 'tool-bar))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    67
      ((and (facep 'toolbar)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    68
	    (not (facep 'tool-bar)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    69
       (put 'tool-bar 'face-alias 'toolbar)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    70
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    71
(defvar color-theme-xemacs-p (and (featurep 'xemacs) 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    72
                                  (string-match "XEmacs" emacs-version))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    73
  "Non-nil if running XEmacs.")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    74
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    75
;; Add this since it appears to miss in emacs-2x
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    76
(or (fboundp 'replace-in-string)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    77
    (defun replace-in-string (target old new)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    78
      (replace-regexp-in-string old new  target)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    79
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    80
;; face-attr-construct has a problem in Emacs 20.7 and older when
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    81
;; dealing with inverse-video faces.  Here is a short test to check
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    82
;; wether you are affected.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    83
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    84
;; (set-background-color "wheat")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    85
;; (set-foreground-color "black")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    86
;; (setq a (make-face 'a-face))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    87
;; (face-spec-set a '((t (:background "white" :foreground "black" :inverse-video t))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    88
;; (face-attr-construct a)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    89
;;     => (:background "black" :inverse-video t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    90
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    91
;; The expected response is the original specification:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    92
;;     => (:background "white" :foreground "black" :inverse-video t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    93
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    94
;; That's why we depend on cus-face.el functionality.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    95
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    96
(cond ((fboundp 'custom-face-attributes-get)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    97
       (defun color-theme-face-attr-construct (face frame)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    98
         (if (atom face)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
    99
             (custom-face-attributes-get face frame)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   100
             (if (and (consp face) (eq (car face) 'quote))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   101
                 (custom-face-attributes-get (cadr face) frame)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   102
                 (custom-face-attributes-get (car face) frame)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   103
      ((fboundp 'face-custom-attributes-get)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   104
       (defalias 'color-theme-face-attr-construct
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   105
	 'face-custom-attributes-get))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   106
      (t
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   107
       (defun color-theme-face-attr-construct (&rest ignore)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   108
	 (error "Unable to construct face attributes"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   109
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   110
(defun color-theme-alist (plist)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   111
  "Transform PLIST into an alist if it is a plist and return it.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   112
If the first element of PLIST is a cons cell, we just return PLIST,
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   113
assuming PLIST to be an alist.  If the first element of plist is not a
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   114
symbol, this is an error: We cannot distinguish a plist from an ordinary
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   115
list, but a list that doesn't start with a symbol is certainly no plist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   116
and no alist.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   117
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   118
This is used to make sure `default-frame-alist' really is an alist and not
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   119
a plist.  In XEmacs, the alist is deprecated; a plist is used instead."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   120
  (cond ((consp (car plist))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   121
	 plist)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   122
	((not (symbolp (car plist)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   123
	 (error "Wrong type argument: plist, %S" plist))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   124
	((featurep 'xemacs)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   125
	 (plist-to-alist plist)))); XEmacs only
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   126
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   127
;; Customization
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   128
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   129
(defgroup color-theme nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   130
  "Color Themes for Emacs.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   131
A color theme consists of frame parameter settings, variable settings,
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   132
and face definitions."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   133
  :version "20.6"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   134
  :group 'faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   135
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   136
(defcustom color-theme-legal-frame-parameters "\\(color\\|mode\\)$"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   137
  "Regexp that matches frame parameter names.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   138
Only frame parameter names that match this regexp can be changed as part
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   139
of a color theme."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   140
  :type '(choice (const :tag "Colors only" "\\(color\\|mode\\)$")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   141
		 (const :tag "Colors, fonts, and size"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   142
			"\\(color\\|mode\\|font\\|height\\|width\\)$")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   143
		 (regexp :tag "Custom regexp"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   144
  :group 'color-theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   145
  :link '(info-link "(elisp)Window Frame Parameters"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   146
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   147
(defcustom color-theme-legal-variables "\\(color\\|face\\)$"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   148
  "Regexp that matches variable names.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   149
Only variables that match this regexp can be changed as part of a color
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   150
theme.  In addition to matching this name, the variables have to be user
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   151
variables (see function `user-variable-p')."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   152
  :type 'regexp
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   153
  :group 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   154
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   155
(defcustom color-theme-illegal-faces "^w3-"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   156
  "Regexp that matches face names forbidden in themes.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   157
The default setting \"^w3-\" excludes w3 faces since these
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   158
are created dynamically."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   159
  :type 'regexp
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   160
  :group 'color-theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   161
  :link '(info-link "(elisp)Faces for Font Lock")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   162
  :link '(info-link "(elisp)Standard Faces"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   163
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   164
(defcustom color-theme-illegal-default-attributes '(:family :height :width)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   165
  "A list of face properties to be ignored when installing faces.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   166
This prevents Emacs from doing terrible things to your display just because
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   167
a theme author likes weird fonts."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   168
  :type '(repeat symbol)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   169
  :group 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   170
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   171
(defcustom color-theme-is-global t
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   172
  "*Determines wether a color theme is installed on all frames or not.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   173
If non-nil, color themes will be installed for all frames.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   174
If nil, color themes will be installed for the selected frame only.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   175
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   176
A possible use for this variable is dynamic binding. Here is a larger
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   177
example to put in your ~/.emacs; it will make the Blue Sea color theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   178
the default used for the first frame, and it will create two additional
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   179
frames with different color themes.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   180
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   181
setup:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   182
    \(require 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   183
    ;; set default color theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   184
    \(color-theme-blue-sea)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   185
    ;; create some frames with different color themes
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   186
    \(let ((color-theme-is-global nil))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   187
      \(select-frame (make-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   188
      \(color-theme-gnome2)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   189
      \(select-frame (make-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   190
      \(color-theme-standard))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   191
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   192
Please note that using XEmacs and and a nil value for
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   193
color-theme-is-global will ignore any variable settings for the color
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   194
theme, since XEmacs doesn't have frame-local variable bindings.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   195
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   196
Also note that using Emacs and a non-nil value for color-theme-is-global
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   197
will install a new color theme for all frames.  Using XEmacs and a
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   198
non-nil value for color-theme-is-global will install a new color theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   199
only on those frames that are not using a local color theme."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   200
  :type 'boolean
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   201
  :group 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   202
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   203
(defcustom color-theme-is-cumulative t
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   204
  "*Determines wether new color themes are installed on top of each other.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   205
If non-nil, installing a color theme will undo all settings made by
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   206
previous color themes."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   207
  :type 'boolean
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   208
  :group 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   209
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   210
(defcustom color-theme-directory nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   211
  "Directory where we can find additionnal themes (personnal).
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   212
Note that there is at least one directory shipped with the official
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   213
color-theme distribution where all contributed themes are located.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   214
This official selection can't be changed with that variable. 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   215
However, you still can decide to turn it on or off and thus,
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   216
not be shown with all themes but yours."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   217
  :type '(repeat string)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   218
  :group 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   219
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   220
(defcustom color-theme-libraries (directory-files 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   221
                                  (concat 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   222
                                   (file-name-directory (locate-library "color-theme"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   223
                                   "/themes") t "^color-theme")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   224
  "A list of files, which will be loaded in color-theme-initialize depending
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   225
on `color-theme-load-all-themes' value. 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   226
This allows a user to prune the default color-themes (which can take a while
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   227
to load)."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   228
  :type '(repeat string)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   229
  :group 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   230
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   231
(defcustom color-theme-load-all-themes t
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   232
  "When t, load all color-theme theme files
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   233
as presented by `color-theme-libraries'. Else
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   234
do not load any of this themes."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   235
  :type 'boolean
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   236
  :group 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   237
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   238
(defcustom color-theme-mode-hook nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   239
  "Hook for color-theme-mode."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   240
  :type 'hook
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   241
  :group 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   242
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   243
(defvar color-theme-mode-map
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   244
  (let ((map (make-sparse-keymap)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   245
    (define-key map (kbd "RET") 'color-theme-install-at-point)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   246
    (define-key map (kbd "c") 'list-colors-display)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   247
    (define-key map (kbd "d") 'color-theme-describe)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   248
    (define-key map (kbd "f") 'list-faces-display)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   249
    (define-key map (kbd "i") 'color-theme-install-at-point)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   250
    (define-key map (kbd "l") 'color-theme-install-at-point-for-current-frame)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   251
    (define-key map (kbd "p") 'color-theme-print)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   252
    (define-key map (kbd "q") 'bury-buffer)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   253
    (define-key map (kbd "?") 'color-theme-describe)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   254
    (if color-theme-xemacs-p
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   255
	(define-key map (kbd "<button2>") 'color-theme-install-at-mouse)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   256
      (define-key map (kbd "<mouse-2>") 'color-theme-install-at-mouse))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   257
    map)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   258
  "Mode map used for the buffer created by `color-theme-select'.")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   259
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   260
(defvar color-theme-initialized nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   261
  "Internal variable determining whether color-theme-initialize has been invoked yet")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   262
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   263
(defvar color-theme-buffer-name "*Color Theme Selection*"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   264
  "Name of the color theme selection buffer.")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   265
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   266
(defvar color-theme-original-frame-alist nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   267
  "nil until one of the color themes has been installed.")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   268
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   269
(defvar color-theme-history nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   270
  "List of color-themes called, in reverse order")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   271
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   272
(defcustom color-theme-history-max-length nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   273
  "Max length of history to maintain.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   274
Two other values are acceptable: t means no limit, and
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   275
nil means that no history is maintained."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   276
  :type '(choice (const :tag "No history" nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   277
		 (const :tag "Unlimited length" t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   278
		 integer)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   279
  :group 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   280
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   281
(defvar color-theme-counter 0
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   282
  "Counter for every addition to `color-theme-history'.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   283
This counts how many themes were installed, regardless
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   284
of `color-theme-history-max-length'.")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   285
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   286
(defvar color-theme-entry-path (cond
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   287
                                ;; Emacs 22.x and later
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   288
                                ((lookup-key global-map [menu-bar tools])
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   289
                                 '("tools"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   290
                                ;; XEmacs
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   291
                                ((featurep 'xemacs)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   292
                                 (setq tool-entry '("Tools")))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   293
                                ;; Emacs < 22
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   294
                                (t
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   295
                                 '("Tools")))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   296
  "Menu tool entry path.")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   297
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   298
(defun color-theme-add-to-history (name)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   299
  "Add color-theme NAME to `color-theme-history'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   300
  (setq color-theme-history
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   301
	(cons (list name color-theme-is-cumulative)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   302
	      color-theme-history)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   303
	color-theme-counter (+ 1 color-theme-counter))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   304
  ;; Truncate the list if necessary.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   305
  (when (and (integerp color-theme-history-max-length)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   306
	     (>= (length color-theme-history)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   307
		 color-theme-history-max-length))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   308
    (setcdr (nthcdr (1- color-theme-history-max-length)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   309
		    color-theme-history)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   310
	    nil)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   311
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   312
;; (let ((l '(1 2 3 4 5)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   313
;;   (setcdr (nthcdr 2 l) nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   314
;;   l)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   315
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   316
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   317
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   318
;; List of color themes used to create the *Color Theme Selection*
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   319
;; buffer.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   320
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   321
(defvar color-themes
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   322
  '((color-theme-aalto-dark "Aalto Dark" "Jari Aalto <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   323
    (color-theme-aalto-light "Aalto Light" "Jari Aalto <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   324
    (color-theme-aliceblue "Alice Blue" "Girish Bharadwaj <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   325
    (color-theme-andreas "Andreas" "Andreas Busch <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   326
    (color-theme-arjen "Arjen" "Arjen Wiersma <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   327
    (color-theme-beige-diff "Beige Diff" "Alex Schroeder <[email protected]>" t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   328
    (color-theme-bharadwaj "Bharadwaj" "Girish Bharadwaj <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   329
    (color-theme-bharadwaj-slate "Bharadwaj Slate" "Girish Bharadwaj <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   330
    (color-theme-billw "Billw" "Bill White <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   331
    (color-theme-black-on-gray "BlackOnGray" "Sudhir Bhojwani <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   332
    (color-theme-blippblopp "Blipp Blopp" "Thomas Sicheritz-Ponten<[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   333
    (color-theme-simple-1 "Black" "Jonadab <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   334
    (color-theme-blue-erc "Blue ERC" "Alex Schroeder <[email protected]>" t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   335
    (color-theme-blue-gnus "Blue Gnus" "Alex Schroeder <[email protected]>" t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   336
    (color-theme-blue-mood "Blue Mood" "Nelson Loyola <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   337
    (color-theme-blue-sea "Blue Sea" "Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   338
    (color-theme-calm-forest "Calm Forest" "Artur Hefczyc <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   339
    (color-theme-charcoal-black "Charcoal Black" "Lars Chr. Hausmann <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   340
    (color-theme-goldenrod "Cheap Goldenrod" "Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   341
    (color-theme-clarity "Clarity and Beauty" "Richard Wellum <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   342
    (color-theme-classic "Classic" "Frederic Giroud <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   343
    (color-theme-comidia "Comidia" "Marcelo Dias de Toledo <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   344
    (color-theme-jsc-dark "Cooper Dark" "John S Cooper <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   345
    (color-theme-jsc-light "Cooper Light" "John S Cooper <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   346
    (color-theme-jsc-light2 "Cooper Light 2" "John S Cooper <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   347
    (color-theme-dark-blue "Dark Blue" "Chris McMahan <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   348
    (color-theme-dark-blue2 "Dark Blue 2" "Chris McMahan <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   349
    (color-theme-dark-green "Dark Green" "[email protected]")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   350
    (color-theme-dark-laptop "Dark Laptop" "Laurent Michel <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   351
    (color-theme-deep-blue "Deep Blue" "Tomas Cerha <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   352
    (color-theme-digital-ofs1 "Digital OFS1" "Gareth Owen <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   353
    (color-theme-euphoria "Euphoria" "[email protected]")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   354
    (color-theme-feng-shui "Feng Shui" "Walter Higgins <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   355
    (color-theme-fischmeister "Fischmeister"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   356
			      "Sebastian Fischmeister <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   357
    (color-theme-gnome "Gnome" "Jonadab <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   358
    (color-theme-gnome2 "Gnome 2" "Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   359
    (color-theme-gray1 "Gray1" "Paul Pulli <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   360
    (color-theme-gray30 "Gray30" "Girish Bharadwaj <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   361
    (color-theme-kingsajz "Green Kingsajz" "Olgierd `Kingsajz' Ziolko <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   362
    (color-theme-greiner "Greiner" "Kevin Greiner <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   363
    (color-theme-gtk-ide "GTK IDE" "Gordon Messmer <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   364
    (color-theme-high-contrast "High Contrast" "Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   365
    (color-theme-hober "Hober" "Edward O'Connor <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   366
    (color-theme-infodoc "Infodoc" "Frederic Giroud <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   367
    (color-theme-jb-simple "JB Simple" "[email protected]")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   368
    (color-theme-jedit-grey "Jedit Grey" "Gordon Messmer <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   369
    (color-theme-jonadabian "Jonadab" "Jonadab <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   370
    (color-theme-jonadabian-slate "Jonadabian Slate" "Jonadab <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   371
    (color-theme-katester "Katester" "[email protected]")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   372
    (color-theme-late-night "Late Night" "Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   373
    (color-theme-lawrence "Lawrence" "lawrence mitchell <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   374
    (color-theme-lethe "Lethe" "Ivica Loncar <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   375
    (color-theme-ld-dark "Linh Dang Dark" "Linh Dang <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   376
    (color-theme-marine "Marine" "Girish Bharadwaj <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   377
    (color-theme-matrix "Matrix" "Walter Higgins <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   378
    (color-theme-marquardt "Marquardt" "Colin Marquardt <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   379
    (color-theme-midnight "Midnight" "Gordon Messmer <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   380
    (color-theme-mistyday "Misty Day" "Hari Kumar <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   381
    (color-theme-montz "Montz" "Brady Montz <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   382
    (color-theme-oswald "Oswald" "Tom Oswald <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   383
    (color-theme-parus "Parus" "Jon K Hellan <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   384
    (color-theme-pierson "Pierson" "Dan L. Pierson <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   385
    (color-theme-ramangalahy "Ramangalahy" "Solofo Ramangalahy <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   386
    (color-theme-raspopovic "Raspopovic" "Pedja Raspopovic <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   387
    (color-theme-renegade "Renegade" "Dave Benjamin <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   388
    (color-theme-resolve "Resolve" "Damien Elmes <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   389
    (color-theme-retro-green "Retro Green" "Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   390
    (color-theme-retro-orange "Retro Orange" "Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   391
    (color-theme-robin-hood "Robin Hood" "Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   392
    (color-theme-rotor "Rotor" "Jinwei Shen <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   393
    (color-theme-ryerson "Ryerson" "Luis Fernandes <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   394
    (color-theme-salmon-diff "Salmon Diff" "Alex Schroeder <[email protected]>" t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   395
    (color-theme-salmon-font-lock "Salmon Font-Lock" "Alex Schroeder <[email protected]>" t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   396
    (color-theme-scintilla "Scintilla" "Gordon Messmer <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   397
    (color-theme-shaman "Shaman" "[email protected]")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   398
    (color-theme-sitaramv-nt "Sitaram NT"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   399
			     "Sitaram Venkatraman <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   400
    (color-theme-sitaramv-solaris "Sitaram Solaris"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   401
				  "Sitaram Venkatraman <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   402
    (color-theme-snow "Snow" "Nicolas Rist <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   403
    (color-theme-snowish "Snowish" "Girish Bharadwaj <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   404
    (color-theme-standard-ediff "Standard Ediff" "Emacs Team, added by Alex Schroeder <[email protected]>" t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   405
    (color-theme-standard "Standard Emacs 20" "Emacs Team, added by Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   406
    (color-theme-emacs-21 "Standard Emacs 21" "Emacs Team, added by Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   407
    (color-theme-emacs-nw "Standard Emacs 21 No Window" "Emacs Team, added by D. Goel <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   408
    (color-theme-xemacs "Standard XEmacs" "XEmacs Team, added by Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   409
    (color-theme-subtle-blue "Subtle Blue" "Chris McMahan <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   410
    (color-theme-subtle-hacker "Subtle Hacker" "Colin Walters <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   411
    (color-theme-taming-mr-arneson "Taming Mr Arneson" "Erik Arneson <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   412
    (color-theme-taylor "Taylor" "Art Taylor <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   413
    (color-theme-tty-dark "TTY Dark" "O Polite <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   414
    (color-theme-vim-colors "Vim Colors" "Michael Soulier <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   415
    (color-theme-whateveryouwant "Whateveryouwant" "Fabien Penso <[email protected]>, color by Scott Jaderholm <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   416
    (color-theme-wheat "Wheat" "Alex Schroeder <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   417
    (color-theme-pok-wob "White On Black" "S. Pokrovsky <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   418
    (color-theme-pok-wog "White On Grey" "S. Pokrovsky <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   419
    (color-theme-word-perfect "WordPerfect" "Thomas Gehrlein <[email protected]>")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   420
    (color-theme-xp "XP" "Girish Bharadwaj <[email protected]>"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   421
  "List of color themes.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   422
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   423
Each THEME is itself a three element list (FUNC NAME MAINTAINER &optional LIBRARY).
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   424
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   425
FUNC is a color theme function which does the setup.  The function
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   426
FUNC may call `color-theme-install'.  The color theme function may be
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   427
interactive.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   428
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   429
NAME is the name of the theme and MAINTAINER is the name and/or email of
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   430
the maintainer of the theme.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   431
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   432
If LIBRARY is non-nil, the color theme will be considered a library and
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   433
may not be shown in the default menu.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   434
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   435
If you defined your own color theme and want to add it to this list,
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   436
use something like this:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   437
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   438
  (add-to-list 'color-themes '(color-theme-gnome2 \"Gnome2\" \"Alex\"))")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   439
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   440
;;; Functions
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   441
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   442
(defun color-theme-backup-original-values ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   443
  "Back up the original `default-frame-alist'.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   444
The values are stored in `color-theme-original-frame-alist' on
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   445
startup."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   446
  (if (null color-theme-original-frame-alist)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   447
      (setq color-theme-original-frame-alist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   448
	    (color-theme-filter (frame-parameters (selected-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   449
				color-theme-legal-frame-parameters))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   450
(add-hook 'after-init-hook 'color-theme-backup-original-values)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   451
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   452
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   453
(defun color-theme-select (&optional arg)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   454
  "Displays a special buffer for selecting and installing a color theme.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   455
With optional prefix ARG, this buffer will include color theme libraries
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   456
as well.  A color theme library is in itself not complete, it must be
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   457
used as part of another color theme to be useful.  Thus, color theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   458
libraries are mainly useful for color theme authors."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   459
  (interactive "P")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   460
  (unless color-theme-initialized (color-theme-initialize))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   461
  (switch-to-buffer (get-buffer-create color-theme-buffer-name))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   462
  (setq buffer-read-only nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   463
  (erase-buffer)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   464
  ;; recreate the snapshot if necessary
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   465
  (when (or (not (assq 'color-theme-snapshot color-themes))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   466
	    (not (commandp 'color-theme-snapshot)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   467
    (fset 'color-theme-snapshot (color-theme-make-snapshot))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   468
    (setq color-themes (delq (assq 'color-theme-snapshot color-themes)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   469
			     color-themes)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   470
	  color-themes (delq (assq 'bury-buffer color-themes)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   471
			     color-themes)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   472
	  color-themes (append '((color-theme-snapshot
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   473
				  "[Reset]" "Undo changes, if possible.")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   474
				 (bury-buffer
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   475
				  "[Quit]" "Bury this buffer."))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   476
			     color-themes)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   477
  (dolist (theme color-themes)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   478
    (let ((func (nth 0 theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   479
	  (name (nth 1 theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   480
	  (author (nth 2 theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   481
	  (library (nth 3 theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   482
	  (desc))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   483
      (when (or (not library) arg)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   484
	(setq desc (format "%-23s %s" 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   485
			   (if library (concat name " [lib]") name)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   486
			   author))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   487
	(put-text-property 0 (length desc) 'color-theme func desc)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   488
	(put-text-property 0 (length name) 'face 'bold desc)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   489
	(put-text-property 0 (length name) 'mouse-face 'highlight desc)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   490
	(insert desc)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   491
	(newline))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   492
  (goto-char (point-min))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   493
  (setq buffer-read-only t)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   494
  (set-buffer-modified-p nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   495
  (color-theme-mode))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   496
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   497
(when (require 'easymenu)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   498
  (easy-menu-add-item nil color-theme-entry-path "--")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   499
  (easy-menu-add-item  nil color-theme-entry-path
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   500
                       ["Color Themes" color-theme-select t]))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   501
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   502
(defun color-theme-mode ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   503
  "Major mode to select and install color themes.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   504
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   505
Use \\[color-theme-install-at-point] to install a color theme on all frames.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   506
Use \\[color-theme-install-at-point-for-current-frame] to install a color theme for the current frame only.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   507
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   508
The changes are applied on top of your current setup.  This is a
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   509
feature.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   510
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   511
Some of the themes should be considered extensions to the standard color
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   512
theme: they modify only a limited number of faces and variables.  To
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   513
verify the final look of a color theme, install the standard color
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   514
theme, then install the other color theme.  This is a feature. It allows
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   515
you to mix several color themes.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   516
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   517
Use \\[color-theme-describe] to read more about the color theme function at point.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   518
If you want to install the color theme permanently, put the call to the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   519
color theme function into your ~/.emacs:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   520
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   521
    \(require 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   522
    \(color-theme-gnome2)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   523
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   524
If you worry about the size of color-theme.el: You are right.  Use
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   525
\\[color-theme-print] to print the current color theme and save the resulting buffer
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   526
as ~/.emacs-color-theme.  Now you can install only this specific color
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   527
theme in your .emacs:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   528
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   529
    \(load-file \"~/.emacs-color-theme\")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   530
    \(my-color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   531
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   532
The Emacs menu is not affected by color themes within Emacs.  Depending
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   533
on the toolkit you used to compile Emacs, you might have to set specific
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   534
X ressources.  See the info manual for more information.  Here is an
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   535
example ~/.Xdefaults fragment:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   536
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   537
    emacs*Background: DarkSlateGray
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   538
    emacs*Foreground: wheat
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   539
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   540
\\{color-theme-mode-map}
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   541
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   542
The color themes are listed in `color-themes', which see."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   543
  (kill-all-local-variables)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   544
  (setq major-mode 'color-theme-mode)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   545
  (setq mode-name "Color Themes")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   546
  (use-local-map color-theme-mode-map)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   547
  (when (functionp 'goto-address); Emacs
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   548
    (goto-address))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   549
  (run-hooks 'color-theme-mode-hook))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   550
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   551
;;; Commands in Color Theme Selection mode
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   552
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   553
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   554
(defun color-theme-describe ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   555
  "Describe color theme listed at point.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   556
This shows the documentation of the value of text-property color-theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   557
at point.  The text-property color-theme should be a color theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   558
function.  See `color-themes'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   559
  (interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   560
  (describe-function (get-text-property (point) 'color-theme)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   561
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   562
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   563
(defun color-theme-install-at-mouse (event)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   564
  "Install color theme clicked upon using the mouse.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   565
First argument EVENT is used to set point.  Then
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   566
`color-theme-install-at-point' is called."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   567
  (interactive "e")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   568
  (save-excursion
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   569
    (mouse-set-point event)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   570
    (color-theme-install-at-point)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   571
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   572
;;;autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   573
(defun color-theme-install-at-point ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   574
  "Install color theme at point.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   575
This calls the value of the text-property `color-theme' at point.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   576
The text-property `color-theme' should be a color theme function.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   577
See `color-themes'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   578
  (interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   579
  (let ((func (get-text-property (point) 'color-theme)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   580
    ;; install theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   581
    (if func
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   582
	(funcall func))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   583
    ;; If goto-address is being used, remove all overlays in the current
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   584
    ;; buffer and run it again.  The face used for the mail addresses in
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   585
    ;; the the color theme selection buffer is based on the variable
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   586
    ;; goto-address-mail-face.  Changes in that variable will not affect
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   587
    ;; existing overlays, however, thereby confusing users.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   588
    (when (functionp 'goto-address); Emacs
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   589
      (dolist (o (overlays-in (point-min) (point-max)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   590
	(delete-overlay o))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   591
      (goto-address))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   592
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   593
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   594
(defun color-theme-install-at-point-for-current-frame ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   595
  "Install color theme at point for current frame only.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   596
Binds `color-theme-is-global' to nil and calls
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   597
`color-theme-install-at-point'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   598
  (interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   599
  (let ((color-theme-is-global nil))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   600
    (color-theme-install-at-point)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   601
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   602
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   603
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   604
;; Taking a snapshot of the current color theme and pretty printing it.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   605
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   606
(defun color-theme-filter (old-list regexp &optional exclude)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   607
  "Filter OLD-LIST.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   608
The resulting list will be newly allocated and contains only elements
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   609
with names matching REGEXP.  OLD-LIST may be a list or an alist.  If you
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   610
want to filter a plist, use `color-theme-alist' to convert your plist to
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   611
an alist, first.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   612
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   613
If the optional argument EXCLUDE is non-nil, then the sense is
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   614
reversed: only non-matching elements will be retained."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   615
  (let (elem new-list)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   616
    (dolist (elem old-list)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   617
      (setq name (symbol-name (if (listp elem) (car elem) elem)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   618
      (when (or (and (not exclude)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   619
		     (string-match regexp name))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   620
		(and exclude
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   621
		     (not (string-match regexp name))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   622
	;; Now make sure that if elem is a cons cell, and the cdr of
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   623
	;; that cons cell is a string, then we need a *new* string in
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   624
	;; the new list.  Having a new cons cell is of no use because
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   625
	;; modify-frame-parameters will modify this string, thus
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   626
	;; modifying our color theme functions!
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   627
	(when (and (consp elem)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   628
		   (stringp (cdr elem)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   629
	  (setq elem (cons (car elem)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   630
			   (copy-sequence (cdr elem)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   631
	;; Now store elem
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   632
	(setq new-list (cons elem new-list))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   633
    new-list))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   634
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   635
(defun color-theme-spec-filter (spec)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   636
  "Filter the attributes in SPEC.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   637
This makes sure that SPEC has the form ((t (PLIST ...))).
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   638
Only properties not in `color-theme-illegal-default-attributes'
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   639
are included in the SPEC returned."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   640
  (let ((props (cadar spec))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   641
	result prop val)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   642
    (while props
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   643
      (setq prop (nth 0 props)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   644
	    val (nth 1 props)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   645
	    props (nthcdr 2 props))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   646
      (unless (memq prop color-theme-illegal-default-attributes)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   647
	(setq result (cons val (cons prop result)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   648
    `((t ,(nreverse result)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   649
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   650
;; (color-theme-spec-filter '((t (:background "blue3"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   651
;; (color-theme-spec-filter '((t (:stipple nil :background "Black" :foreground "SteelBlue" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :width semi-condensed :family "misc-fixed"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   652
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   653
(defun color-theme-plist-delete (plist prop)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   654
  "Delete property PROP from property list PLIST by side effect.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   655
This modifies PLIST."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   656
  ;; deal with prop at the start
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   657
  (while (eq (car plist) prop)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   658
    (setq plist (cddr plist)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   659
  ;; deal with empty plist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   660
  (when plist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   661
    (let ((lastcell (cdr plist))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   662
	  (l (cddr plist)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   663
      (while l
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   664
	(if (eq (car l) prop)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   665
	    (progn
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   666
	      (setq l (cddr l))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   667
	      (setcdr lastcell l))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   668
	  (setq lastcell (cdr l)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   669
		l (cddr l))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   670
  plist)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   671
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   672
;; (color-theme-plist-delete '(a b c d e f g h) 'a)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   673
;; (color-theme-plist-delete '(a b c d e f g h) 'b)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   674
;; (color-theme-plist-delete '(a b c d e f g h) 'c)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   675
;; (color-theme-plist-delete '(a b c d e f g h) 'g)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   676
;; (color-theme-plist-delete '(a b c d c d e f g h) 'c)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   677
;; (color-theme-plist-delete '(a b c d e f c d g h) 'c)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   678
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   679
(if (or (featurep 'xemacs)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   680
	(< emacs-major-version 21))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   681
    (defalias 'color-theme-spec-compat 'identity)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   682
  (defun color-theme-spec-compat (spec)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   683
    "Filter the attributes in SPEC such that is is never invalid.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   684
Example: Eventhough :bold works in Emacs, it is not recognized by
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   685
`customize-face' -- and then the face is uncustomizable.  This
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   686
function replaces a :bold attribute with the corresponding :weight
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   687
attribute, if there is no :weight, or deletes it.  This undoes the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   688
doings of `color-theme-spec-canonical-font', more or less."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   689
    (let ((props (cadar spec)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   690
      (when (plist-member props :bold)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   691
	(setq props (color-theme-plist-delete props :bold))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   692
	(unless (plist-member props :weight)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   693
	  (setq props (plist-put props :weight 'bold))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   694
      (when (plist-member props :italic)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   695
	(setq props (color-theme-plist-delete props :italic))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   696
	(unless (plist-member props :slant)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   697
	  (setq props (plist-put props :slant 'italic))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   698
      `((t ,props)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   699
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   700
;; (color-theme-spec-compat '((t (:foreground "blue" :bold t))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   701
;; (color-theme-spec-compat '((t (:bold t :foreground "blue" :weight extra-bold))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   702
;; (color-theme-spec-compat '((t (:italic t :foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   703
;; (color-theme-spec-compat '((t (:slant oblique :italic t :foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   704
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   705
(defun color-theme-spec-canonical-font (atts)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   706
  "Add :bold and :italic attributes if necessary."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   707
  ;; add these to the front of atts -- this will keept the old value for
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   708
  ;; customize-face in Emacs 21.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   709
  (when (and (memq (plist-get atts :weight)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   710
		   '(ultra-bold extra-bold bold semi-bold))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   711
	     (not (plist-get atts :bold)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   712
    (setq atts (cons :bold (cons t atts))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   713
  (when (and (not (memq (plist-get atts :slant)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   714
			'(normal nil)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   715
	     (not (plist-get atts :italic)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   716
    (setq atts (cons :italic (cons t atts))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   717
  atts)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   718
;; (color-theme-spec-canonical-font (color-theme-face-attr-construct 'bold (selected-frame)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   719
;; (defface foo '((t (:weight extra-bold))) "foo")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   720
;; (color-theme-spec-canonical-font (color-theme-face-attr-construct 'foo (selected-frame)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   721
;; (face-spec-set 'foo '((t (:weight extra-bold))) nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   722
;; (face-spec-set 'foo '((t (:bold t))) nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   723
;; (face-spec-set 'foo '((t (:bold t :weight extra-bold))) nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   724
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   725
;; Handle :height according to NEWS file for Emacs 21
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   726
(defun color-theme-spec-resolve-height (old new)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   727
  "Return the new height given OLD and NEW height.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   728
OLD is the current setting, NEW is the setting inherited from."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   729
  (cond ((not old)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   730
	 new)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   731
	((integerp old)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   732
	 old)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   733
	((and (floatp old)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   734
	      (integerp new))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   735
	 (round (* old new)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   736
	((and (floatp old)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   737
	      (floatp new))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   738
	 (* old new))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   739
	((and (functionp old)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   740
	      (integerp new))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   741
	 (round (funcall old new)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   742
	((and (functionp old)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   743
	      (float new))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   744
	 `(lambda (f) (* (funcall ,old f) ,new)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   745
	((and (functionp old)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   746
	      (functionp new))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   747
	 `(lambda (f) (* (funcall ,old (funcall ,new f)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   748
	(t
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   749
	 (error "Illegal :height attributes: %S or %S" old new))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   750
;; (color-theme-spec-resolve-height 12 1.2)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   751
;; (color-theme-spec-resolve-height 1.2 1.2)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   752
;; (color-theme-spec-resolve-height 1.2 12)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   753
;; (color-theme-spec-resolve-height 1.2 'foo)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   754
;; (color-theme-spec-resolve-height (lambda (f) (* 2 f)) 5)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   755
;; (color-theme-spec-resolve-height (lambda (f) (* 2 f)) 2.0)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   756
;; the following lambda is the result from the above calculation
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   757
;; (color-theme-spec-resolve-height (lambda (f) (* (funcall (lambda (f) (* 2 f)) f) 2.0)) 5)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   758
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   759
(defun color-theme-spec-resolve-inheritance (atts)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   760
  "Resolve all occurences of the :inherit attribute."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   761
  (let ((face (plist-get atts :inherit)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   762
    ;; From the Emacs 21 NEWS file: "Attributes from inherited faces are
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   763
    ;; merged into the face like an underlying face would be." --
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   764
    ;; therefore properties of the inherited face only add missing
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   765
    ;; attributes.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   766
    (when face
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   767
      ;; remove :inherit face from atts -- this assumes only one
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   768
      ;; :inherit attribute.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   769
      (setq atts (delq ':inherit (delq face atts)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   770
      (let ((more-atts (color-theme-spec-resolve-inheritance
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   771
			(color-theme-face-attr-construct
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   772
			 face (selected-frame))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   773
	    att val)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   774
	(while more-atts
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   775
	  (setq att (car more-atts)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   776
		val (cadr more-atts)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   777
		more-atts (cddr more-atts))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   778
	  ;; Color-theme assumes that no value is ever 'unspecified.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   779
	  (cond ((eq att ':height); cumulative effect!
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   780
		 (setq atts (plist-put atts 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   781
				       ':height 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   782
				       (color-theme-spec-resolve-height
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   783
					(plist-get atts att) 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   784
					val))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   785
		;; Default: Only put if it has not been specified before.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   786
		((not (plist-get atts att))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   787
		 (setq atts (cons att (cons val atts))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   788
		  
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   789
))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   790
    atts))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   791
;; (color-theme-spec-resolve-inheritance '(:bold t))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   792
;; (color-theme-spec-resolve-inheritance '(:bold t :foreground "blue"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   793
;; (color-theme-face-attr-construct 'font-lock-comment-face (selected-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   794
;; (color-theme-spec-resolve-inheritance '(:bold t :inherit font-lock-comment-face))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   795
;; (color-theme-spec-resolve-inheritance '(:bold t :foreground "red" :inherit font-lock-comment-face))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   796
;; (color-theme-face-attr-construct 'Info-title-2-face (selected-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   797
;; (color-theme-face-attr-construct 'Info-title-3-face (selected-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   798
;; (color-theme-face-attr-construct 'Info-title-4-face (selected-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   799
;; (color-theme-spec-resolve-inheritance '(:inherit Info-title-2-face))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   800
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   801
;; The :inverse-video attribute causes Emacs to swap foreground and
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   802
;; background colors, XEmacs does not.  Therefore, if anybody chooses
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   803
;; the inverse-video attribute, we 1. swap the colors ourselves in Emacs
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   804
;; and 2. we remove the inverse-video attribute in Emacs and XEmacs.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   805
;; Inverse-video is only useful on a monochrome tty.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   806
(defun color-theme-spec-maybe-invert (atts)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   807
  "Remove the :inverse-video attribute from ATTS.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   808
If ATTS contains :inverse-video t, remove it and swap foreground and
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   809
background color.  Return ATTS."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   810
  (let ((inv (plist-get atts ':inverse-video)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   811
    (if inv
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   812
	(let (result att)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   813
	  (while atts
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   814
	    (setq att (car atts)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   815
		  atts (cdr atts))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   816
	    (cond ((and (eq att :foreground) (not color-theme-xemacs-p))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   817
		   (setq result (cons :background result)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   818
		  ((and (eq att :background) (not color-theme-xemacs-p))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   819
		   (setq result (cons :foreground result)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   820
		  ((eq att :inverse-video)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   821
		   (setq atts (cdr atts))); this prevents using dolist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   822
		  (t
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   823
		   (setq result (cons att result)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   824
	  (nreverse result))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   825
      ;; else
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   826
      atts)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   827
;; (color-theme-spec-maybe-invert '(:bold t))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   828
;; (color-theme-spec-maybe-invert '(:foreground "blue"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   829
;; (color-theme-spec-maybe-invert '(:background "red"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   830
;; (color-theme-spec-maybe-invert '(:inverse-video t))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   831
;; (color-theme-spec-maybe-invert '(:inverse-video t :foreground "red"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   832
;; (color-theme-spec-maybe-invert '(:inverse-video t :background "red"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   833
;; (color-theme-spec-maybe-invert '(:inverse-video t :background "red" :foreground "blue" :bold t))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   834
;; (color-theme-spec-maybe-invert '(:inverse-video nil :background "red" :foreground "blue" :bold t))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   835
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   836
(defun color-theme-spec (face)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   837
  "Return a list for FACE which has the form (FACE SPEC).
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   838
See `defface' for the format of SPEC.  In this case we use only one
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   839
DISPLAY, t, and determine ATTS using `color-theme-face-attr-construct'.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   840
If ATTS is nil, (nil) is used  instead.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   841
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   842
If ATTS contains :inverse-video t, we remove it and swap foreground and
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   843
background color using `color-theme-spec-maybe-invert'.  We do this
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   844
because :inverse-video is handled differently in Emacs and XEmacs.  We
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   845
will loose on a tty without colors, because in that situation,
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   846
:inverse-video means something."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   847
  (let ((atts
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   848
	 (color-theme-spec-canonical-font
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   849
	  (color-theme-spec-maybe-invert
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   850
	   (color-theme-spec-resolve-inheritance
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   851
	    (color-theme-face-attr-construct face (selected-frame)))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   852
    (if atts
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   853
	`(,face ((t ,atts)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   854
      `(,face ((t (nil)))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   855
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   856
(defun color-theme-get-params ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   857
  "Return a list of frame parameter settings usable in a color theme.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   858
Such an alist may be installed by `color-theme-install-frame-params'.  The
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   859
frame parameters returned must match `color-theme-legal-frame-parameters'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   860
  (let ((params (color-theme-filter (frame-parameters (selected-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   861
				    color-theme-legal-frame-parameters)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   862
    (sort params (lambda (a b) (string< (symbol-name (car a))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   863
					(symbol-name (car b)))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   864
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   865
(defun color-theme-get-vars ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   866
  "Return a list of variable settings usable in a color theme.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   867
Such an alist may be installed by `color-theme-install-variables'.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   868
The variable names must match `color-theme-legal-variables', and the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   869
variable must be a user variable according to `user-variable-p'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   870
  (let ((vars)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   871
	(val))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   872
    (mapatoms (lambda (v)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   873
		(and (boundp v)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   874
		     (user-variable-p v)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   875
		     (string-match color-theme-legal-variables
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   876
				   (symbol-name v))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   877
		     (setq val (eval v))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   878
		     (add-to-list 'vars (cons v val)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   879
    (sort vars (lambda (a b) (string< (car a) (car b))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   880
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   881
(defun color-theme-print-alist (alist)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   882
  "Print ALIST."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   883
  (insert "\n     " (if alist "(" "nil"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   884
  (dolist (elem alist)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   885
    (when (= (preceding-char) ?\))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   886
      (insert "\n      "))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   887
    (prin1 elem (current-buffer)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   888
  (when (= (preceding-char) ?\)) (insert ")")))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   889
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   890
(defun color-theme-get-faces ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   891
  "Return a list of faces usable in a color theme.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   892
Such an alist may be installed by `color-theme-install-faces'.  The
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   893
faces returned must not match `color-theme-illegal-faces'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   894
  (let ((faces (color-theme-filter (face-list) color-theme-illegal-faces t)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   895
    ;; default face must come first according to comments in
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   896
    ;; custom-save-faces, the rest is to be sorted by name
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   897
    (cons 'default (sort (delq 'default faces) 'string-lessp))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   898
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   899
(defun color-theme-get-face-definitions ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   900
  "Return face settings usable in a color-theme."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   901
  (let ((faces (color-theme-get-faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   902
    (mapcar 'color-theme-spec faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   903
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   904
(defun color-theme-print-faces (faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   905
  "Print face settings for all faces returned by `color-theme-get-faces'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   906
  (when faces
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   907
    (insert "\n     "))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   908
  (dolist (face faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   909
    (when (= (preceding-char) ?\))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   910
      (insert "\n     "))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   911
    (prin1 face (current-buffer))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   912
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   913
(defun color-theme-reset-faces ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   914
  "Reset face settings for all faces returned by `color-theme-get-faces'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   915
  (let ((faces (color-theme-get-faces))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   916
	(face) (spec) (entry)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   917
	(frame (if color-theme-is-global nil (selected-frame))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   918
    (while faces
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   919
      (setq entry (color-theme-spec (car faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   920
      (setq face (nth 0 entry))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   921
      (setq spec '((t (nil))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   922
      (setq faces (cdr faces))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   923
      (if (functionp 'face-spec-reset-face)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   924
	  (face-spec-reset-face face frame)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   925
	(face-spec-set face spec frame)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   926
	(if color-theme-is-global
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   927
	    (put face 'face-defface-spec spec))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   928
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   929
(defun color-theme-print-theme (func doc params vars faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   930
  "Print a theme into the current buffer.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   931
FUNC is the function name, DOC the doc string, PARAMS the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   932
frame parameters, VARS the variable bindings, and FACES
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   933
the list of faces and their specs."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   934
  (insert "(defun " (symbol-name func) " ()\n"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   935
	  "  \"" doc "\"\n"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   936
	  "  (interactive)\n"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   937
	  "  (color-theme-install\n"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   938
	  "   '(" (symbol-name func))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   939
  ;; alist of frame parameters
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   940
  (color-theme-print-alist params)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   941
  ;; alist of variables
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   942
  (color-theme-print-alist vars)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   943
  ;; remaining elements of snapshot: face specs
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   944
  (color-theme-print-faces faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   945
  (insert ")))\n")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   946
  (insert "(add-to-list 'color-themes '(" (symbol-name func) " "
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   947
          " \"THEME NAME\" \"YOUR NAME\"))")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   948
  (goto-char (point-min)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   949
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   950
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   951
(defun color-theme-print (&optional buf)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   952
  "Print the current color theme function.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   953
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   954
You can contribute this function to <URL:news:gnu.emacs.sources> or
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   955
paste it into your .emacs file and call it.  That should recreate all
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   956
the settings necessary for your color theme.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   957
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   958
Example:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   959
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   960
    \(require 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   961
    \(defun my-color-theme ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   962
      \"Color theme by Alex Schroeder, created 2000-05-17.\"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   963
      \(interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   964
      \(color-theme-install
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   965
       '(...
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   966
	 ...
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   967
	 ...)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   968
    \(my-color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   969
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   970
If you want to use a specific color theme function, you can call the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   971
color theme function in your .emacs directly.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   972
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   973
Example:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   974
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   975
    \(require 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   976
    \(color-theme-gnome2)"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   977
  (interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   978
  (message "Pretty printing current color theme function...")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   979
  (switch-to-buffer (if buf
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   980
			buf
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   981
		      (get-buffer-create "*Color Theme*")))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   982
  (unless buf
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   983
    (setq buffer-read-only nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   984
    (erase-buffer))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   985
  ;; insert defun
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   986
  (insert "(eval-when-compile"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   987
          "    (require 'color-theme))\n")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   988
  (color-theme-print-theme 'my-color-theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   989
			   (concat "Color theme by "
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   990
				   (if (string= "" user-full-name)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   991
				       (user-login-name)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   992
				     user-full-name)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   993
				   ", created " (format-time-string "%Y-%m-%d") ".")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   994
			   (color-theme-get-params)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   995
			   (color-theme-get-vars)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   996
			   (mapcar 'color-theme-spec (color-theme-get-faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   997
  (unless buf
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   998
    (emacs-lisp-mode))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
   999
  (goto-char (point-min))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1000
  (message "Pretty printing current color theme function... done"))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1001
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1002
(defun color-theme-analyze-find-theme (code)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1003
  "Find the sexpr that calls `color-theme-install'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1004
  (let (theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1005
    (while (and (not theme) code)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1006
      (when (eq (car code) 'color-theme-install)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1007
	(setq theme code))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1008
      (when (listp (car code))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1009
	(setq theme (color-theme-analyze-find-theme (car code))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1010
      (setq code (cdr code)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1011
    theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1012
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1013
;; (equal (color-theme-analyze-find-theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1014
;; 	'(defun color-theme-blue-eshell ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1015
;; 	   "Color theme for eshell faces only."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1016
;; 	   (color-theme-install
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1017
;; 	    '(color-theme-blue-eshell
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1018
;; 	      nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1019
;; 	      (eshell-ls-archive-face ((t (:bold t :foreground "IndianRed"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1020
;; 	      (eshell-ls-backup-face ((t (:foreground "Grey"))))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1021
;;        '(color-theme-install
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1022
;; 	 (quote
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1023
;; 	  (color-theme-blue-eshell
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1024
;; 	   nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1025
;; 	   (eshell-ls-archive-face ((t (:bold t :foreground "IndianRed"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1026
;; 	   (eshell-ls-backup-face ((t (:foreground "Grey")))))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1027
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1028
(defun color-theme-analyze-add-face (a b regexp faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1029
  "If only one of A or B are in FACES, the other is added, and FACES is returned.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1030
If REGEXP is given, this is only done if faces contains a match for regexps."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1031
  (when (or (not regexp)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1032
	    (catch 'found
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1033
	      (dolist (face faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1034
		(when (string-match regexp (symbol-name (car face)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1035
		  (throw 'found t)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1036
    (let ((face-a (assoc a faces))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1037
	  (face-b (assoc b faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1038
      (if (and face-a (not face-b))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1039
	  (setq faces (cons (list b (nth 1 face-a))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1040
			    faces))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1041
	(if (and (not face-a) face-b)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1042
	    (setq faces (cons (list a (nth 1 face-b))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1043
			      faces))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1044
  faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1045
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1046
;; (equal (color-theme-analyze-add-face
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1047
;; 	'blue 'violet nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1048
;; 	'((blue ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1049
;; 	  (bold ((t (:bold t))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1050
;;        '((violet ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1051
;; 	 (blue ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1052
;; 	 (bold ((t (:bold t))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1053
;; (equal (color-theme-analyze-add-face
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1054
;; 	'violet 'blue nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1055
;; 	'((blue ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1056
;; 	  (bold ((t (:bold t))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1057
;;        '((violet ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1058
;; 	 (blue ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1059
;; 	 (bold ((t (:bold t))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1060
;; (equal (color-theme-analyze-add-face
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1061
;; 	'violet 'blue "foo"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1062
;; 	'((blue ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1063
;; 	  (bold ((t (:bold t))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1064
;;        '((blue ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1065
;; 	 (bold ((t (:bold t))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1066
;; (equal (color-theme-analyze-add-face
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1067
;; 	'violet 'blue "blue"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1068
;; 	'((blue ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1069
;; 	  (bold ((t (:bold t))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1070
;;        '((violet ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1071
;; 	 (blue ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1072
;; 	 (bold ((t (:bold t))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1073
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1074
(defun color-theme-analyze-add-faces (faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1075
  "Add missing faces to FACES and return it."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1076
  ;; The most important thing is to add missing faces for the other
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1077
  ;; editor.  These are the most important faces to check.  The
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1078
  ;; following rules list two faces, A and B.  If either of the two is
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1079
  ;; part of the theme, the other must be, too.  The optional third
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1080
  ;; argument specifies a regexp.  Only if an existing face name
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1081
  ;; matches this regexp, is the rule applied.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1082
  (let ((rules '((font-lock-builtin-face font-lock-reference-face)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1083
		 (font-lock-doc-face font-lock-doc-string-face)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1084
		 (font-lock-constant-face font-lock-preprocessor-face)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1085
		 ;; In Emacs 21 `modeline' is just an alias for
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1086
		 ;; `mode-line'.  I recommend the use of
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1087
		 ;; `modeline' until further notice.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1088
		 (modeline mode-line)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1089
		 (modeline modeline-buffer-id)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1090
		 (modeline modeline-mousable)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1091
		 (modeline modeline-mousable-minor-mode)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1092
		 (region primary-selection)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1093
		 (region zmacs-region)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1094
		 (font-lock-string-face dired-face-boring "^dired")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1095
		 (font-lock-function-name-face dired-face-directory "^dired")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1096
		 (default dired-face-executable "^dired")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1097
		 (font-lock-warning-face dired-face-flagged "^dired")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1098
		 (font-lock-warning-face dired-face-marked "^dired")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1099
		 (default dired-face-permissions "^dired")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1100
		 (default dired-face-setuid "^dired")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1101
		 (default dired-face-socket "^dired")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1102
		 (font-lock-keyword-face dired-face-symlink "^dired")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1103
		 (tool-bar menu))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1104
    (dolist (rule rules)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1105
      (setq faces (color-theme-analyze-add-face
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1106
		   (nth 0 rule) (nth 1 rule) (nth 2 rule) faces))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1107
  ;; The `fringe' face defines what the left and right borders of the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1108
  ;; frame look like in Emacs 21.  To give them default fore- and
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1109
  ;; background colors, use (fringe ((t (nil)))) in your color theme.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1110
  ;; Usually it makes more sense to choose a color slightly lighter or
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1111
  ;; darker from the default background.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1112
  (unless (assoc 'fringe faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1113
    (setq faces (cons '(fringe ((t (nil)))) faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1114
  ;; The tool-bar should not be part of the frame-parameters, since it
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1115
  ;; should not appear or disappear depending on the color theme.  The
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1116
  ;; apppearance of the toolbar, however, can be changed by the color
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1117
  ;; theme.  For Emacs 21, use the `tool-bar' face.  The easiest way
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1118
  ;; to do this is to give it the default fore- and background colors.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1119
  ;; This can be achieved using (tool-bar ((t (nil)))) in the theme.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1120
  ;; Usually it makes more sense, however, to provide the same colors
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1121
  ;; as used in the `menu' face, and to specify a :box attribute.  In
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1122
  ;; order to alleviate potential Emacs/XEmacs incompatibilities,
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1123
  ;; `toolbar' will be defined as an alias for `tool-bar' if it does
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1124
  ;; not exist, and vice-versa.  This is done eventhough the face
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1125
  ;; `toolbar' seems to have no effect on XEmacs.  If you look at
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1126
  ;; XEmacs lisp/faces.el, however, you will find that it is in fact
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1127
  ;; referenced for XPM stuff.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1128
  (unless (assoc 'tool-bar faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1129
    (setq faces (cons '(tool-bar ((t (nil)))) faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1130
  ;; Move the default face back to the front, and sort the rest.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1131
  (unless (eq (caar faces) 'default)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1132
    (let ((face (assoc 'default faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1133
      (setq faces (cons face
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1134
			(sort (delete face faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1135
			      (lambda (a b)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1136
				(string-lessp (car a) (car b))))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1137
  faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1138
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1139
(defun color-theme-analyze-remove-heights (faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1140
  "Remove :height property where it is an integer and return FACES."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1141
  ;; I don't recommend making font sizes part of a color theme.  Most
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1142
  ;; users would be surprised to see their font sizes change when they
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1143
  ;; install a color-theme.  Therefore, remove all :height attributes
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1144
  ;; if the value is an integer.  If the value is a float, this is ok
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1145
  ;; -- the value is relative to the default height.  One notable
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1146
  ;; exceptions is for a color-theme created for visually impaired
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1147
  ;; people.  These *must* use a larger font in order to be usable.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1148
  (let (result)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1149
    (dolist (face faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1150
      (let ((props (cadar (nth 1 face))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1151
	(if (and (plist-member props :height)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1152
		 (integerp (plist-get props :height)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1153
	    (setq props (color-theme-plist-delete props :height)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1154
		  result (cons (list (car face) `((t ,props)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1155
			       result))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1156
	  (setq result (cons face result)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1157
    (nreverse result)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1158
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1159
;; (equal (color-theme-analyze-remove-heights
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1160
;; 	'((blue ((t (:foreground "blue" :height 2))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1161
;; 	  (bold ((t (:bold t :height 1.0))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1162
;;        '((blue ((t (:foreground "blue"))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1163
;; 	 (bold ((t (:bold t :height 1.0))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1164
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1165
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1166
(defun color-theme-analyze-defun ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1167
  "Once you have a color-theme printed, check for missing faces.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1168
This is used by maintainers who receive a color-theme submission
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1169
and want to make sure it follows the guidelines by the color-theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1170
author."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1171
  ;; The support for :foreground and :background attributes works for
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1172
  ;; Emacs 20 and 21 as well as for XEmacs.  :inverse-video is taken
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1173
  ;; care of while printing color themes.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1174
  (interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1175
  ;; Parse the stuff and find the call to color-theme-install
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1176
  (save-excursion
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1177
    (save-restriction
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1178
      (narrow-to-defun)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1179
      ;; define the function
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1180
      (eval-defun nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1181
      (goto-char (point-min))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1182
      (let* ((code (read (current-buffer)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1183
	     (theme (color-theme-canonic
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1184
		     (eval
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1185
		      (cadr
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1186
		       (color-theme-analyze-find-theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1187
			code)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1188
	     (func (color-theme-function theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1189
	     (doc (documentation func t))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1190
	     (variables (color-theme-variables theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1191
	     (faces (color-theme-faces theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1192
	     (params (color-theme-frame-params theme)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1193
	(setq faces (color-theme-analyze-remove-heights
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1194
		     (color-theme-analyze-add-faces faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1195
	;; Remove any variable bindings of faces that point to their
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1196
	;; symbol?  Perhaps not, because another theme might want to
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1197
	;; change this, so it is important to be able to reset them.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1198
	;; 	(let (result)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1199
	;; 	  (dolist (var variables)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1200
	;; 	    (unless (eq (car var) (cdr var))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1201
	;; 	      (setq result (cons var result))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1202
	;; 	  (setq variables (nreverse result)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1203
	;; Now modify the theme directly.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1204
	(setq theme (color-theme-analyze-find-theme code))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1205
	(setcdr (cadadr theme) (list params variables faces))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1206
	(message "Pretty printing analysed color theme function...")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1207
	(with-current-buffer (get-buffer-create "*Color Theme*")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1208
	  (setq buffer-read-only nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1209
	  (erase-buffer)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1210
	  ;; insert defun
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1211
	  (color-theme-print-theme func doc params variables faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1212
	  (emacs-lisp-mode))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1213
	(message "Pretty printing analysed color theme function... done")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1214
	(ediff-buffers (current-buffer)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1215
		       (get-buffer "*Color Theme*"))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1216
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1217
;;; Creating a snapshot of the current color theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1218
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1219
(defun color-theme-snapshot nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1220
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1221
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1222
(defun color-theme-make-snapshot ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1223
  "Return the definition of the current color-theme.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1224
The function returned will recreate the color-theme in use at the moment."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1225
  (eval `(lambda ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1226
	   "The color theme in use when the selection buffer was created.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1227
\\[color-theme-select] creates the color theme selection buffer.  At the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1228
same time, this snapshot is created as a very simple undo mechanism.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1229
The snapshot is created via `color-theme-snapshot'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1230
	   (interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1231
	   (color-theme-install
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1232
	    '(color-theme-snapshot
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1233
	      ;; alist of frame parameters
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1234
	      ,(color-theme-get-params)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1235
	      ;; alist of variables
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1236
	      ,(color-theme-get-vars)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1237
	      ;; remaining elements of snapshot: face specs
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1238
	      ,@(color-theme-get-face-definitions))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1239
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1240
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1241
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1242
;;; Handling the various parts of a color theme install
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1243
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1244
(defvar color-theme-frame-param-frobbing-rules
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1245
  '((foreground-color default foreground)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1246
    (background-color default background))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1247
  "List of rules to use when frobbing faces based on frame parameters.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1248
This is only necessary for XEmacs, because in Emacs 21 changing the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1249
frame paramters automatically affects the relevant faces.")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1250
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1251
;; fixme: silent the bytecompiler with set-face-property
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1252
(defun color-theme-frob-faces (params)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1253
  "Change certain faces according to PARAMS.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1254
This uses `color-theme-frame-param-frobbing-rules'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1255
  (dolist (rule color-theme-frame-param-frobbing-rules)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1256
    (let* ((param (nth 0 rule))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1257
	   (face (nth 1 rule))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1258
	   (prop (nth 2 rule))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1259
	   (val (cdr (assq param params)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1260
	   (frame (if color-theme-is-global nil (selected-frame))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1261
      (when val
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1262
	(set-face-property face prop val frame)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1263
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1264
(defun color-theme-alist-reduce (old-list)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1265
  "Reduce OLD-LIST.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1266
The resulting list will be newly allocated and will not contain any elements
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1267
with duplicate cars.  This will speed the installation of new themes by
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1268
only installing unique attributes."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1269
  (let (new-list)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1270
    (dolist (elem old-list)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1271
      (when (not (assq (car elem) new-list))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1272
	(setq new-list (cons elem new-list))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1273
    new-list))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1274
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1275
(defun color-theme-install-frame-params (params)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1276
  "Change frame parameters using alist PARAMETERS.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1277
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1278
If `color-theme-is-global' is non-nil, all frames are modified using
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1279
`modify-frame-parameters' and the PARAMETERS are prepended to
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1280
`default-frame-alist'.  The value of `initial-frame-alist' is not
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1281
modified.  If `color-theme-is-global' is nil, only the selected frame is
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1282
modified.  If `color-theme-is-cumulative' is nil, the frame parameters
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1283
are restored from `color-theme-original-frame-alist'.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1284
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1285
If the current frame parameters have a parameter `minibuffer' with
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1286
value `only', then the frame parameters are not installed, since this
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1287
indicates a dedicated minibuffer frame.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1288
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1289
Called from `color-theme-install'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1290
  (setq params (color-theme-filter
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1291
		params color-theme-legal-frame-parameters))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1292
  ;; We have a new list in params now, therefore we may use
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1293
  ;; destructive nconc.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1294
  (if color-theme-is-global
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1295
      (let ((frames (frame-list)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1296
	(if (or color-theme-is-cumulative
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1297
		(null color-theme-original-frame-alist))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1298
	    (setq default-frame-alist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1299
		  (append params (color-theme-alist default-frame-alist))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1300
		  minibuffer-frame-alist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1301
		  (append params (color-theme-alist minibuffer-frame-alist)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1302
	  (setq default-frame-alist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1303
		(append params color-theme-original-frame-alist)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1304
		minibuffer-frame-alist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1305
		(append params (color-theme-alist minibuffer-frame-alist))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1306
	(setq default-frame-alist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1307
	      (color-theme-alist-reduce default-frame-alist)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1308
	      minibuffer-frame-alist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1309
	      (color-theme-alist-reduce minibuffer-frame-alist))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1310
	(dolist (frame frames)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1311
	  (let ((params (if (eq 'only (cdr (assq 'minibuffer (frame-parameters frame))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1312
			    minibuffer-frame-alist
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1313
			  default-frame-alist)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1314
	    (condition-case var
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1315
		(modify-frame-parameters frame params)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1316
	      (error (message "Error using params %S: %S" params var))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1317
    (condition-case var
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1318
	(modify-frame-parameters (selected-frame) params)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1319
      (error (message "Error using params %S: %S" params var))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1320
  (when color-theme-xemacs-p
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1321
    (color-theme-frob-faces params)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1322
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1323
;; (setq default-frame-alist (cons '(height . 30) default-frame-alist))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1324
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1325
(defun color-theme-install-variables (vars)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1326
  "Change variables using alist VARS.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1327
All variables matching `color-theme-legal-variables' are set.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1328
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1329
If `color-theme-is-global' and `color-theme-xemacs-p' are nil, variables
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1330
are made frame-local before setting them.  Variables are set using `set'
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1331
in either case.  This may lead to problems if changing the variable
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1332
requires the usage of the function specified with the :set tag in
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1333
defcustom declarations.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1334
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1335
Called from `color-theme-install'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1336
  (let ((vars (color-theme-filter vars color-theme-legal-variables)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1337
    (dolist (var vars)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1338
      (if (or color-theme-is-global color-theme-xemacs-p)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1339
	  (set (car var) (cdr var))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1340
	(make-variable-frame-local (car var))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1341
	(modify-frame-parameters (selected-frame) (list var))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1342
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1343
(defun color-theme-install-faces (faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1344
  "Change faces using FACES.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1345
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1346
Change faces for all frames and create any faces listed in FACES which
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1347
don't exist.  The modified faces will be marked as \"unchanged from
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1348
its standard setting\".  This is OK, since the changes made by
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1349
installing a color theme should never by saved in .emacs by
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1350
customization code.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1351
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1352
FACES should be a list where each entry has the form:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1353
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1354
  (FACE SPEC)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1355
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1356
See `defface' for the format of SPEC.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1357
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1358
If `color-theme-is-global' is non-nil, faces are modified on all frames
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1359
using `face-spec-set'.  If `color-theme-is-global' is nil, faces are
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1360
only modified on the selected frame.  Non-existing faces are created
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1361
using `make-empty-face' in either case.  If `color-theme-is-cumulative'
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1362
is nil, all faces are reset before installing the new faces.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1363
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1364
Called from `color-theme-install'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1365
  ;; clear all previous faces
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1366
  (when (not color-theme-is-cumulative)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1367
    (color-theme-reset-faces))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1368
  ;; install new faces
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1369
  (let ((faces (color-theme-filter faces color-theme-illegal-faces t))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1370
	(frame (if color-theme-is-global nil (selected-frame))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1371
    (dolist (entry faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1372
      (let ((face (nth 0 entry))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1373
	    (spec (nth 1 entry)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1374
	(or (facep face)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1375
	    (make-empty-face face))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1376
	;; remove weird properties from the default face only
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1377
	(when (eq face 'default)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1378
	  (setq spec (color-theme-spec-filter spec)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1379
	;; Emacs/XEmacs customization issues: filter out :bold when
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1380
	;; the spec contains :weight, etc, such that the spec remains
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1381
	;; "valid" for custom.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1382
	(setq spec (color-theme-spec-compat spec))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1383
	;; using a spec of ((t (nil))) to reset a face doesn't work
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1384
	;; in Emacs 21, we use the new function face-spec-reset-face
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1385
	;; instead
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1386
	(if (and (functionp 'face-spec-reset-face)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1387
		 (equal spec '((t (nil)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1388
	    (face-spec-reset-face face frame)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1389
	  (condition-case var
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1390
	      (progn
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1391
		(face-spec-set face spec frame)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1392
		(if color-theme-is-global
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1393
		    (put face 'face-defface-spec spec)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1394
	    (error (message "Error using spec %S: %S" spec var))))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1395
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1396
;; `custom-set-faces' is unusable here because it doesn't allow to set
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1397
;; the faces for one frame only.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1398
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1399
;; Emacs `face-spec-set': If FRAME is nil, the face is created and
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1400
;; marked as a customized face.  This is achieved by setting the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1401
;; `face-defface-spec' property.  If we don't, new frames will not be
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1402
;; created using the face we installed because `face-spec-set' is
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1403
;; broken: If given a FRAME of nil, it will not set the default faces;
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1404
;; instead it will walk through all the frames and set modify the faces.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1405
;; If we do set a property (`saved-face' or `face-defface-spec'),
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1406
;; `make-frame' will correctly use the faces we defined with our color
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1407
;; theme.  If we used the property `saved-face',
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1408
;; `customize-save-customized' will save all the faces installed as part
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1409
;; of a color-theme in .emacs.  That's why we use the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1410
;; `face-defface-spec' property.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1411
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1412
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1413
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1414
;;; Theme accessor functions, canonicalization, merging, comparing
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1415
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1416
(defun color-theme-canonic (theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1417
  "Return the canonic form of THEME.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1418
This deals with all the backwards compatibility stuff."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1419
  (let (function frame-params variables faces)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1420
    (when (functionp (car theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1421
      (setq function (car theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1422
	    theme (cdr theme)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1423
    (setq frame-params (car theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1424
	  theme (cdr theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1425
    ;; optional variable defintions (for backwards compatibility)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1426
    (when (listp (caar theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1427
      (setq variables (car theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1428
	    theme (cdr theme)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1429
    ;; face definitions
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1430
    (setq faces theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1431
    (list function frame-params variables faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1432
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1433
(defun color-theme-function (theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1434
  "Return function used to create THEME."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1435
  (nth 0 theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1436
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1437
(defun color-theme-frame-params (theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1438
  "Return frame-parameters defined by THEME."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1439
  (nth 1 theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1440
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1441
(defun color-theme-variables (theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1442
  "Return variables set by THEME."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1443
  (nth 2 theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1444
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1445
(defun color-theme-faces (theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1446
  "Return faces defined by THEME."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1447
  (nth 3 theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1448
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1449
(defun color-theme-merge-alists (&rest alists)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1450
  "Merges all the alist arguments into one alist.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1451
Only the first instance of every key will be part of the resulting
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1452
alist.  Membership will be tested using `assq'."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1453
  (let (result)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1454
    (dolist (l alists)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1455
      (dolist (entry l)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1456
	(unless (assq (car entry) result)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1457
	  (setq result (cons entry result)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1458
    (nreverse result)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1459
;; (color-theme-merge-alists '((a . 1) (b . 2)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1460
;; (color-theme-merge-alists '((a . 1) (b . 2) (a . 3)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1461
;; (color-theme-merge-alists '((a . 1) (b . 2)) '((a . 3)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1462
;; (color-theme-merge-alists '((a . 1) (b . 2)) '((c . 3)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1463
;; (color-theme-merge-alists '((a . 1) (b . 2)) '((c . 3) (d . 4)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1464
;; (color-theme-merge-alists '((a . 1) (b . 2)) '((c . 3) (d . 4) (b . 5)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1465
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1466
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1467
(defun color-theme-compare (theme-a theme-b)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1468
  "Compare two color themes.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1469
This will print the differences between installing THEME-A and
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1470
installing THEME-B.  Note that the order is important: If a face is
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1471
defined in THEME-A and not in THEME-B, then this will not show up as a
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1472
difference, because there is no reset before installing THEME-B.  If a
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1473
face is defined in THEME-B and not in THEME-A, then this will show up as
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1474
a difference."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1475
  (interactive
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1476
   (list
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1477
    (intern
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1478
     (completing-read "Theme A: "
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1479
		      (mapcar (lambda (i) (list (symbol-name (car i))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1480
			      color-themes)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1481
		      (lambda (i) (string-match "color-theme" (car i)))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1482
    (intern
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1483
     (completing-read "Theme B: "
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1484
		      (mapcar (lambda (i) (list (symbol-name (car i))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1485
			      color-themes)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1486
		      (lambda (i) (string-match "color-theme" (car i)))))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1487
  ;; install the themes in a new frame and get the definitions
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1488
  (let ((color-theme-is-global nil))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1489
    (select-frame (make-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1490
    (funcall theme-a)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1491
    (setq theme-a (list theme-a
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1492
			(color-theme-get-params)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1493
			(color-theme-get-vars)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1494
			(color-theme-get-face-definitions)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1495
    (funcall theme-b)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1496
    (setq theme-b (list theme-b
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1497
			(color-theme-get-params)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1498
			(color-theme-get-vars)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1499
			(color-theme-get-face-definitions)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1500
    (delete-frame))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1501
  (let ((params (set-difference
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1502
		 (color-theme-frame-params theme-b)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1503
		 (color-theme-frame-params theme-a)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1504
		 :test 'equal))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1505
	(vars (set-difference
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1506
	       (color-theme-variables theme-b)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1507
	       (color-theme-variables theme-a)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1508
	       :test 'equal))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1509
	(faces (set-difference
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1510
		(color-theme-faces theme-b)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1511
		(color-theme-faces theme-a)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1512
		:test 'equal)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1513
    (list 'diff
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1514
	  params
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1515
	  vars
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1516
	  faces)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1517
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1518
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1519
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1520
;;; Installing a color theme
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1521
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1522
(defun color-theme-install (theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1523
  "Install a color theme defined by frame parameters, variables and faces.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1524
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1525
The theme is installed for all present and future frames; any missing
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1526
faces are created.  See `color-theme-install-faces'.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1527
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1528
THEME is a color theme definition.  See below for more information.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1529
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1530
If you want to install a color theme from your .emacs, use the output
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1531
generated by `color-theme-print'.  This produces color theme function
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1532
which you can copy to your .emacs.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1533
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1534
A color theme definition is a list:
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1535
\([FUNCTION] FRAME-PARAMETERS VARIABLE-SETTINGS FACE-DEFINITIONS)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1536
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1537
FUNCTION is the color theme function which called `color-theme-install'.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1538
This is no longer used.  There was a time when this package supported
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1539
automatic factoring of color themes.  This has been abandoned.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1540
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1541
FRAME-PARAMETERS is an alist of frame parameters.  These are installed
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1542
with `color-theme-install-frame-params'.  These are installed last such
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1543
that any changes to the default face can be changed by the frame
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1544
parameters.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1545
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1546
VARIABLE-DEFINITIONS is an alist of variable settings.  These are
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1547
installed with `color-theme-install-variables'.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1548
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1549
FACE-DEFINITIONS is an alist of face definitions.  These are installed
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1550
with `color-theme-install-faces'.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1551
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1552
If `color-theme-is-cumulative' is nil, a color theme will undo face and
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1553
frame-parameter settings of previous color themes."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1554
  (setq theme (color-theme-canonic theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1555
  (color-theme-install-variables (color-theme-variables theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1556
  (color-theme-install-faces (color-theme-faces theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1557
  ;; frame parameters override faces
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1558
  (color-theme-install-frame-params (color-theme-frame-params theme))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1559
  (when color-theme-history-max-length
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1560
    (color-theme-add-to-history
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1561
     (car theme))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1562
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1563
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1564
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1565
;; Sharing your stuff
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1566
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1567
(defun color-theme-submit ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1568
  "Submit your color-theme to the maintainer."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1569
  (interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1570
  (require 'reporter)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1571
  (let ((reporter-eval-buffer (current-buffer))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1572
	final-resting-place
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1573
	after-sep-pos
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1574
	(reporter-status-message "Formatting buffer...")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1575
	(reporter-status-count 0)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1576
	(problem "Yet another color-theme")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1577
	(agent (reporter-compose-outgoing))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1578
	(mailbuf (current-buffer))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1579
	hookvar)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1580
    ;; do the work
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1581
    (require 'sendmail)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1582
    ;; If mailbuf did not get made visible before, make it visible now.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1583
    (let (same-window-buffer-names same-window-regexps)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1584
      (pop-to-buffer mailbuf)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1585
      ;; Just in case the original buffer is not visible now, bring it
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1586
      ;; back somewhere
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1587
      (and pop-up-windows (display-buffer reporter-eval-buffer)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1588
    (goto-char (point-min))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1589
    (mail-position-on-field "to")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1590
    (insert color-theme-maintainer-address)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1591
    (mail-position-on-field "subject")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1592
    (insert problem)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1593
    ;; move point to the body of the message
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1594
    (mail-text)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1595
    (setq after-sep-pos (point))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1596
    (unwind-protect
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1597
	(progn
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1598
	  (setq final-resting-place (point-marker))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1599
	  (goto-char final-resting-place))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1600
      (color-theme-print (current-buffer))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1601
      (goto-char final-resting-place)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1602
      (insert "\n\n")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1603
      (goto-char final-resting-place)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1604
      (insert "Hello there!\n\nHere's my color theme named: ")
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1605
      (set-marker final-resting-place nil))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1606
    ;; compose the minibuf message and display this.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1607
    (let* ((sendkey-whereis (where-is-internal
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1608
			     (get agent 'sendfunc) nil t))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1609
	   (abortkey-whereis (where-is-internal
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1610
			      (get agent 'abortfunc) nil t))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1611
	   (sendkey (if sendkey-whereis
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1612
			(key-description sendkey-whereis)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1613
		      "C-c C-c")); TBD: BOGUS hardcode
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1614
	   (abortkey (if abortkey-whereis
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1615
			 (key-description abortkey-whereis)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1616
		       "M-x kill-buffer"))); TBD: BOGUS hardcode
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1617
      (message "Enter a message and type %s to send or %s to abort."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1618
	       sendkey abortkey))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1619
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1620
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1621
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1622
;; Use this to define themes
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1623
(defmacro define-color-theme (name author description &rest forms)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1624
  (let ((n name))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1625
    `(progn 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1626
       (add-to-list 'color-themes
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1627
                    (list ',n
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1628
                          (upcase-initials
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1629
                           (replace-in-string
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1630
                            (replace-in-string 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1631
                             (symbol-name ',n) "^color-theme-" "") "-" " "))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1632
                          ,author))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1633
       (defun ,n ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1634
	 ,description
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1635
	 (interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1636
         ,@forms))))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1637
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1638
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1639
;;; FIXME: is this useful ??
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1640
;;;###autoload
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1641
(defun color-theme-initialize ()
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1642
  "Initialize the color theme package by loading color-theme-libraries."
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1643
  (interactive)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1644
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1645
  (cond ((and (not color-theme-load-all-themes)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1646
              color-theme-directory)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1647
         (setq color-theme-libraries 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1648
               (directory-files color-theme-directory t "^color-theme")))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1649
        (color-theme-directory
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1650
         (push (cdr (directory-files color-theme-directory t "^color-theme")) 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1651
               color-theme-libraries)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1652
  (dolist (library color-theme-libraries)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1653
    (load library)))
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1654
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1655
(when nil
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1656
  (setq color-theme-directory "themes/"
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1657
        color-theme-load-all-themes nil)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1658
  (color-theme-initialize)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1659
)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1660
;; TODO: I don't like all those function names cluttering up my namespace.
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1661
;; Instead, a hashtable for the color-themes should be created. Now that 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1662
;; define-color-theme is around, it should be easy to change in just the
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1663
;; one place. 
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1664
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1665
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1666
(provide 'color-theme)
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1667
2c6b198426df Cleaned up color themes a little. Added thirdparty color theme elisp for os x.
Luke Hoersten <Luke@Hoersten.org>
parents:
diff changeset
  1668
;;; color-theme.el ends here