• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching refs:theme

710 	       (custom-push-theme 'theme-value symbol 'user 'set
732 ;; Each Custom theme is defined by a symbol, called the theme name.
733 ;; The `theme-settings' property of the theme name records the
734 ;; variable and face settings of the theme. This property is a list
739 ;; - PROP is either `theme-value' or `theme-face'
741 ;; - THEME is the theme name (redundant, but simplifies the code)
742 ;; - VALUE is an expression that gives the theme's setting for SYMBOL.
744 ;; The theme name also has a `theme-feature' property, whose value is
745 ;; specified when the theme is defined (see `custom-declare-theme').
746 ;; Usually, this is just a symbol named THEME-theme. This lets
747 ;; external libraries call (require 'foo-theme).
750 ;; an *enabled* theme has a `theme-value' or `theme-face' property,
755 ;; which have the same meanings as in `theme-settings'.
757 ;; The `theme-value' and `theme-face' lists are ordered by decreasing
758 ;; theme precedence. Thus, the first element is always the one that
761 ;; Each theme is stored in a theme file, with filename THEME-theme.el.
762 ;; Loading a theme basically involves calling (load "THEME-theme")
763 ;; This is done by the function `load-theme'. Loading a theme
766 ;; When a theme is enabled, the `theme-value' and `theme-face'
767 ;; properties for the affected symbols are set. When a theme is
768 ;; disabled, its settings are removed from the `theme-value' and
769 ;; `theme-face' properties, but the theme's own `theme-settings'
774 The default value is the list (user changed). The theme `changed'
776 theme `user' contains all the settings the user customized and saved.
780 (defsubst custom-theme-p (theme)
782 (memq theme custom-known-themes))
784 (defsubst custom-check-theme (theme)
786 (unless (custom-theme-p theme)
787 (error "Unknown theme `%s'" theme)))
789 (defun custom-push-theme (prop symbol theme mode &optional value)
790 "Record VALUE for face or variable SYMBOL in custom theme THEME.
791 PROP is `theme-face' for a face, `theme-value' for a variable.
798 (unless (memq prop '(theme-value theme-face))
799 (error "Unknown theme property"))
801 (setting (assq theme old)) ; '(theme value)
802 (theme-settings ; '(prop symbol theme value)
803 (get theme 'theme-settings)))
808 (dolist (theme-setting theme-settings)
809 (if (and (eq (car theme-setting) prop)
810 (eq (cadr theme-setting) symbol))
811 (setq res theme-setting)))
812 (put theme 'theme-settings (delq res theme-settings)))
817 (dolist (theme-setting theme-settings)
818 (if (and (eq (car theme-setting) prop)
819 (eq (cadr theme-setting) symbol))
820 (setq res theme-setting)))
821 (put theme 'theme-settings
822 (cons (list prop symbol theme value)
823 (delq res theme-settings)))
827 ;; first save the current value to a fake theme, `changed'.
829 ;; theme is later disabled.
831 (if (and (eq prop 'theme-value)
841 (put symbol prop (cons (list theme value) old))
842 (put theme 'theme-settings
843 (cons (list prop symbol theme value)
844 theme-settings))))))
850 These settings are registered as theme `user'.
862 (apply 'custom-theme-set-variables 'user args))
864 (defun custom-theme-set-variables (theme &rest args)
865 "Initialize variables for theme THEME according to settings in ARGS.
879 in SYMBOL's list property `theme-value' \(using `custom-push-theme')."
880 (custom-check-theme theme)
926 (custom-push-theme 'theme-value symbol theme 'set value)
951 (custom-push-theme 'theme-value symbol theme 'set value))
958 ;; A theme file should be named `THEME-theme.el' (where THEME is the theme
959 ;; name), and found in either `custom-theme-directory' or the load path.
965 ;; (custom-theme-set-variables
969 ;; (custom-theme-set-faces
973 ;; (provide-theme 'THEME)
976 ;; The IGNORED arguments to deftheme come from the XEmacs theme code, where
980 (defmacro deftheme (theme &optional doc &rest ignored)
981 "Declare THEME to be a Custom theme.
982 The optional argument DOC is a doc string describing the theme.
984 Any theme `foo' should be defined in a file called `foo-theme.el';
985 see `custom-make-theme-feature' for more information."
986 (let ((feature (custom-make-theme-feature theme)))
990 (list 'custom-declare-theme (list 'quote theme) (list 'quote feature) doc)))
992 (defun custom-declare-theme (theme feature &optional doc &rest ignored)
994 FEATURE is the feature this theme provides. Normally, this is a symbol
995 created from THEME by `custom-make-theme-feature'."
996 (if (memq theme '(user changed))
997 (error "Custom theme cannot be named %S" theme))
998 (add-to-list 'custom-known-themes theme)
999 (put theme 'theme-feature feature)
1000 (when doc (put theme 'theme-documentation doc)))
1002 (defun custom-make-theme-feature (theme)
1003 "Given a symbol THEME, create a new symbol by appending \"-theme\".
1004 Store this symbol in the `theme-feature' property of THEME.
1005 Calling `provide-theme' to provide THEME actually puts `THEME-theme'
1009 Every theme X has a property `provide-theme' whose value is \"X-theme\".
1010 \(load-theme X) then attempts to load the file `X-theme.el'."
1011 (intern (concat (symbol-name theme) "-theme")))
1016 (defcustom custom-theme-directory
1021 "Directory in which Custom theme files should be written.
1022 `load-theme' searches this directory in addition to load-path.
1023 The command `customize-create-theme' writes the files it produces
1029 (defun provide-theme (theme)
1032 property `theme-feature' (which is usually a symbol created by
1033 `custom-make-theme-feature')."
1034 (if (memq theme '(user changed))
1035 (error "Custom theme cannot be named %S" theme))
1036 (custom-check-theme theme)
1037 (provide (get theme 'theme-feature))
1038 ;; Loading a theme also enables it.
1039 (push theme custom-enabled-themes)
1040 ;; `user' must always be the highest-precedence enabled theme.
1044 (enable-theme 'user)))
1046 (defun load-theme (theme)
1047 "Load a theme's settings from its file.
1048 This also enables the theme; use `disable-theme' to disable it."
1049 ;; Note we do no check for validity of the theme here.
1051 (interactive "SCustom theme name: ")
1052 ;; If reloading, clear out the old theme settings.
1053 (when (custom-theme-p theme)
1054 (disable-theme theme)
1055 (put theme 'theme-settings nil)
1056 (put theme 'theme-feature nil)
1057 (put theme 'theme-documentation nil))
1058 (let ((load-path (if (file-directory-p custom-theme-directory)
1059 (cons custom-theme-directory load-path)
1061 (load (symbol-name (custom-make-theme-feature theme)))))
1068 (defun enable-theme (theme)
1070 The newly enabled theme gets the highest precedence (after `user').
1073 If THEME does not specify any theme settings, this tries to load
1074 the theme from its theme file, by calling `load-theme'."
1075 (interactive "SEnable Custom theme: ")
1076 (if (not (custom-theme-p theme))
1077 (load-theme theme)
1079 (let ((settings (get theme 'theme-settings)))
1084 (put symbol prop (cons (cddr s) (assq-delete-all theme spec-list)))
1085 (if (eq prop 'theme-value)
1086 (custom-theme-recalc-variable symbol)
1087 (custom-theme-recalc-face symbol)))))
1088 (unless (eq theme 'user)
1090 (cons theme (delq theme custom-enabled-themes)))
1092 (enable-theme 'user)))))
1097 This does not include the `user' theme, which is set by Customize,
1103 ;; defined in a theme (e.g. `user'). Enabling the theme sets
1104 ;; custom-enabled-themes, which enables the theme...
1109 (dolist (theme (symbol-value symbol))
1110 (if (not (memq theme themes))
1111 (disable-theme theme))))
1112 (dolist (theme (reverse themes))
1114 (enable-theme theme)
1115 (error (progn (push theme failures)
1116 (setq themes (delq theme themes))))))
1117 (enable-theme 'user)
1123 (defsubst custom-theme-enabled-p (theme)
1125 (memq theme custom-enabled-themes))
1127 (defun disable-theme (theme)
1132 "Disable Custom theme: "
1135 (when (custom-theme-enabled-p theme)
1136 (let ((settings (get theme 'theme-settings)))
1141 (put symbol prop (assq-delete-all theme spec-list))
1142 (if (eq prop 'theme-value)
1143 (custom-theme-recalc-variable symbol)
1144 (custom-theme-recalc-face symbol)))))
1146 (delq theme custom-enabled-themes))))
1148 (defun custom-variable-theme-value (variable)
1149 "Return (list VALUE) indicating the custom theme value of VARIABLE.
1153 This function returns nil if no custom theme specifies a value for VARIABLE."
1154 (let* ((theme-value (get variable 'theme-value)))
1155 (if theme-value
1156 (cdr (car theme-value)))))
1158 (defun custom-theme-recalc-variable (variable)
1160 (let ((valspec (custom-variable-theme-value variable)))
1170 (defun custom-theme-recalc-face (face)
1173 (let ((theme-faces (reverse (get face 'theme-face))))
1174 (dolist (spec theme-faces)
1181 ;; theme to reset it to. We just apply the next available theme, so
1184 (defun custom-theme-reset-variables (theme &rest args)
1191 (custom-check-theme theme)
1193 (custom-push-theme 'theme-value (car arg) theme 'reset)))
1197 This creates settings in the `user' theme.
1204 (apply 'custom-theme-reset-variables 'user args))