Show
Ignore:
Timestamp:
09/10/05 10:16:00 (3 years ago)
Author:
miyoshi
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/custom.el

    r3828 r3863  
    584584   "Themes that have been defined with `deftheme'. 
    585585The default value is the list (user standard).  The theme `standard' 
    586 contains the Emacs standard settings from the original Lisp files.  The 
     586contains the settings before custom themes are applied.  The 
    587587theme `user' contains all the settings the user customized and saved. 
    588588Additional themes declared with the `deftheme' macro will be added to 
     
    650650          (setcar (cdr setting) mode) 
    651651          (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)))))))) 
    652663      (put symbol prop (cons (list theme mode value) old))) 
    653664    ;; Record, for each theme, all its settings. 
     
    954965This allows for a file-name convention for autoloading themes: 
    955966Every 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'." 
    957968  (intern (concat (symbol-name theme) "-theme"))) 
    958969  
     
    9971008      "~/.emacs.d/") 
    9981009  "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. 
    10001011The command `customize-create-theme' writes the files it produces 
    10011012into this directory." 
     
    10321043  ;; Make that remain true.  (This has the effect of making user settings 
    10331044  ;; 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) 
    10371048  "Try to load a theme's settings from its file. 
    1038 This also enables the theme; use `custom-disable-theme' to disable it." 
     1049This also enables the theme; use `disable-theme' to disable it." 
    10391050 
    10401051  ;; THEME's feature is stored in THEME's `theme-feature' property. 
     
    10441055  ;; Note we do no check for validity of the theme here. 
    10451056  ;; This allows to pull in themes by a file-name convention 
     1057  (interactive "SCustom theme name: ") 
    10461058  (let ((load-path (if (file-directory-p custom-theme-directory) 
    10471059                       (cons custom-theme-directory load-path) 
     
    10711083    (dolist (theme body) 
    10721084      (cond ((and (consp theme) (eq (car theme) 'reset)) 
    1073              (custom-disable-theme (cadr theme))) 
     1085             (disable-theme (cadr theme))) 
    10741086            ((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))) 
    10771089            (t 
    1078              (require-theme theme))) 
     1090             (load-theme theme))) 
    10791091      (push theme themes-loaded)) 
    10801092    (put by-theme 'theme-loads-themes themes-loaded))) 
     
    10881100;;; Enabling and disabling loaded themes. 
    10891101 
    1090 (defun custom-enable-theme (theme) 
     1102(defun enable-theme (theme) 
    10911103  "Reenable all variable and face settings defined by THEME. 
    10921104The newly enabled theme gets the highest precedence (after `user'). 
    10931105If it is already enabled, just give it highest precedence (after `user')." 
     1106  (interactive "SEnable Custom theme: ") 
    10941107  (let ((settings (get theme 'theme-settings))) 
    10951108    (dolist (s settings) 
     
    11051118  ;; `user' must always be the highest-precedence enabled theme. 
    11061119  (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) 
    11101123  "Disable all variable and face settings defined by THEME. 
    11111124See `custom-known-themes' for a list of known themes." 
     1125  (interactive "SDisable Custom theme: ") 
    11121126  (let ((settings (get theme 'theme-settings))) 
    11131127    (dolist (s settings) 
     
    11151129             (symbol (cadr s)) 
    11161130             (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)) 
    11181132        (if (eq prop 'theme-value) 
    11191133            (custom-theme-recalc-variable symbol) 
     
    11541168        (custom-theme-value (car (car theme-value)) theme-value)))) 
    11551169 
    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-value 
    1161         (custom-theme-value (car (car theme-value)) theme-value)))) 
    1162  
    11631170(defun custom-theme-recalc-variable (variable) 
    11641171  "Set VARIABLE according to currently enabled custom themes." 
     
    11751182(defun custom-theme-recalc-face (face) 
    11761183  "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)))))) 
    11871187  
    11881188(defun custom-theme-reset-variables (theme &rest args)