Changeset 3863 for trunk/lisp/custom.el
- Timestamp:
- 09/10/05 10:16:00 (3 years ago)
- Files:
-
- trunk/lisp/custom.el (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/custom.el
r3828 r3863 584 584 "Themes that have been defined with `deftheme'. 585 585 The default value is the list (user standard). The theme `standard' 586 contains the Emacs standard settings from the original Lisp files. The586 contains the settings before custom themes are applied. The 587 587 theme `user' contains all the settings the user customized and saved. 588 588 Additional themes declared with the `deftheme' macro will be added to … … 650 650 (setcar (cdr setting) mode) 651 651 (setcar (cddr setting) value)) 652 (if (and (null old) 653 (boundp symbol)) 654 (setq old 655 (list 656 (list 'standard 'set 657 (if (eq prop 'theme-value) 658 (symbol-value symbol) 659 (list 660 (append 661 '(t) 662 (custom-face-attributes-get symbol nil)))))))) 652 663 (put symbol prop (cons (list theme mode value) old))) 653 664 ;; Record, for each theme, all its settings. … … 954 965 This allows for a file-name convention for autoloading themes: 955 966 Every theme X has a property `provide-theme' whose value is \"X-theme\". 956 \( require-theme X) then attempts to load the file `X-theme.el'."967 \(load-theme X) then attempts to load the file `X-theme.el'." 957 968 (intern (concat (symbol-name theme) "-theme"))) 958 969 … … 997 1008 "~/.emacs.d/") 998 1009 "Directory in which Custom theme files should be written. 999 ` require-theme' searches this directory in addition to load-path.1010 `load-theme' searches this directory in addition to load-path. 1000 1011 The command `customize-create-theme' writes the files it produces 1001 1012 into this directory." … … 1032 1043 ;; Make that remain true. (This has the effect of making user settings 1033 1044 ;; override the ones just loaded, too.) 1034 ( custom-enable-theme 'user))1035 1036 (defun require-theme (theme)1045 (enable-theme 'user)) 1046 1047 (defun load-theme (theme) 1037 1048 "Try to load a theme's settings from its file. 1038 This also enables the theme; use ` custom-disable-theme' to disable it."1049 This also enables the theme; use `disable-theme' to disable it." 1039 1050 1040 1051 ;; THEME's feature is stored in THEME's `theme-feature' property. … … 1044 1055 ;; Note we do no check for validity of the theme here. 1045 1056 ;; This allows to pull in themes by a file-name convention 1057 (interactive "SCustom theme name: ") 1046 1058 (let ((load-path (if (file-directory-p custom-theme-directory) 1047 1059 (cons custom-theme-directory load-path) … … 1071 1083 (dolist (theme body) 1072 1084 (cond ((and (consp theme) (eq (car theme) 'reset)) 1073 ( custom-disable-theme (cadr theme)))1085 (disable-theme (cadr theme))) 1074 1086 ((and (consp theme) (eq (car theme) 'hidden)) 1075 ( require-theme (cadr theme))1076 ( custom-disable-theme (cadr theme)))1087 (load-theme (cadr theme)) 1088 (disable-theme (cadr theme))) 1077 1089 (t 1078 ( require-theme theme)))1090 (load-theme theme))) 1079 1091 (push theme themes-loaded)) 1080 1092 (put by-theme 'theme-loads-themes themes-loaded))) … … 1088 1100 ;;; Enabling and disabling loaded themes. 1089 1101 1090 (defun custom-enable-theme (theme)1102 (defun enable-theme (theme) 1091 1103 "Reenable all variable and face settings defined by THEME. 1092 1104 The newly enabled theme gets the highest precedence (after `user'). 1093 1105 If it is already enabled, just give it highest precedence (after `user')." 1106 (interactive "SEnable Custom theme: ") 1094 1107 (let ((settings (get theme 'theme-settings))) 1095 1108 (dolist (s settings) … … 1105 1118 ;; `user' must always be the highest-precedence enabled theme. 1106 1119 (unless (eq theme 'user) 1107 ( custom-enable-theme 'user)))1108 1109 (defun custom-disable-theme (theme)1120 (enable-theme 'user))) 1121 1122 (defun disable-theme (theme) 1110 1123 "Disable all variable and face settings defined by THEME. 1111 1124 See `custom-known-themes' for a list of known themes." 1125 (interactive "SDisable Custom theme: ") 1112 1126 (let ((settings (get theme 'theme-settings))) 1113 1127 (dolist (s settings) … … 1115 1129 (symbol (cadr s)) 1116 1130 (spec-list (get symbol prop))) 1117 (put symbol 'theme-value(assq-delete-all theme spec-list))1131 (put symbol prop (assq-delete-all theme spec-list)) 1118 1132 (if (eq prop 'theme-value) 1119 1133 (custom-theme-recalc-variable symbol) … … 1154 1168 (custom-theme-value (car (car theme-value)) theme-value)))) 1155 1169 1156 (defun custom-face-theme-value (face)1157 "Return the face spec of FACE according to currently enabled custom themes.1158 This function returns nil if no custom theme specifies anything for FACE."1159 (let* ((theme-value (get face 'theme-face)))1160 (if theme-value1161 (custom-theme-value (car (car theme-value)) theme-value))))1162 1163 1170 (defun custom-theme-recalc-variable (variable) 1164 1171 "Set VARIABLE according to currently enabled custom themes." … … 1175 1182 (defun custom-theme-recalc-face (face) 1176 1183 "Set FACE according to currently enabled custom themes." 1177 (let ((spec (custom-face-theme-value face))) 1178 (when spec 1179 (put face 'save-face spec)) 1180 (unless spec 1181 (setq spec (get face 'face-defface-spec))) 1182 (when spec 1183 (when (or (get face 'force-face) (facep face)) 1184 (unless (facep face) 1185 (make-empty-face face)) 1186 (face-spec-set face spec))))) 1184 (let ((theme-faces (reverse (get face 'theme-face)))) 1185 (dolist (spec theme-faces) 1186 (face-spec-set face (car (cddr spec)))))) 1187 1187 1188 1188 (defun custom-theme-reset-variables (theme &rest args)
