diff options
| -rw-r--r-- | lisp/cus-face.el | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/lisp/cus-face.el b/lisp/cus-face.el index 6eaaf97288d..967045b9da4 100644 --- a/lisp/cus-face.el +++ b/lisp/cus-face.el | |||
| @@ -345,53 +345,27 @@ FACE's list property `theme-face' \(using `custom-push-theme')." | |||
| 345 | (setq args (cdr (cdr args)))))))) | 345 | (setq args (cdr (cdr args)))))))) |
| 346 | 346 | ||
| 347 | ;;;###autoload | 347 | ;;;###autoload |
| 348 | (defun custom-theme-face-value (face theme) | ||
| 349 | "Return spec of FACE in THEME if THEME modifies FACE. | ||
| 350 | Value is nil otherwise. The association between theme and spec for FACE | ||
| 351 | is stored in FACE's property `theme-face'. The appropriate face | ||
| 352 | is retrieved using `custom-theme-value'." | ||
| 353 | ;; Returns car because the value is stored inside a one element list | ||
| 354 | (car-safe (custom-theme-value theme (get face 'theme-face)))) | ||
| 355 | |||
| 356 | (defun custom-theme-reset-internal-face (face to-theme) | ||
| 357 | "Reset FACE to the value defined by TO-THEME. | ||
| 358 | If FACE is not defined in TO-THEME, reset FACE to the standard | ||
| 359 | value. See `custom-theme-face-value'. The standard value is | ||
| 360 | stored in SYMBOL's property `face-defface-spec' by `defface'." | ||
| 361 | (let ((spec (custom-theme-face-value face to-theme)) | ||
| 362 | was-in-theme) | ||
| 363 | (setq was-in-theme spec) | ||
| 364 | (setq spec (or spec (get face 'face-defface-spec))) | ||
| 365 | (when spec | ||
| 366 | (put face 'save-face was-in-theme) | ||
| 367 | (when (or (get face 'force-face) (facep face)) | ||
| 368 | (unless (facep face) | ||
| 369 | (make-empty-face face)) | ||
| 370 | (face-spec-set face spec))) | ||
| 371 | spec)) | ||
| 372 | |||
| 373 | ;;;###autoload | ||
| 374 | (defun custom-theme-reset-faces (theme &rest args) | 348 | (defun custom-theme-reset-faces (theme &rest args) |
| 375 | "Reset the value of the face to values previously defined. | 349 | "Reset the specs in THEME of some faces to their specs in other themes. |
| 376 | Associate this setting with THEME. | 350 | Each of the arguments ARGS has this form: |
| 377 | |||
| 378 | ARGS is a list of lists of the form | ||
| 379 | 351 | ||
| 380 | (FACE TO-THEME) | 352 | (FACE FROM-THEME) |
| 381 | 353 | ||
| 382 | This means reset FACE to its value in TO-THEME." | 354 | This means reset FACE to its value in FROM-THEME." |
| 383 | (custom-check-theme theme) | 355 | (custom-check-theme theme) |
| 384 | (mapcar '(lambda (arg) | 356 | (dolist (arg args) |
| 385 | (apply 'custom-theme-reset-internal-face arg) | 357 | (custom-push-theme 'theme-face (car arg) theme 'reset (cadr arg)))) |
| 386 | (custom-push-theme 'theme-face (car arg) theme 'reset (cadr arg))) | ||
| 387 | args)) | ||
| 388 | 358 | ||
| 389 | ;;;###autoload | 359 | ;;;###autoload |
| 390 | (defun custom-reset-faces (&rest args) | 360 | (defun custom-reset-faces (&rest args) |
| 391 | "Reset the value of the face to values previously saved. | 361 | "Reset the specs of some faces to their specs in specified themes. |
| 392 | This is the setting assosiated the `user' theme. | 362 | This creates settings in the `user' theme. |
| 363 | |||
| 364 | Each of the arguments ARGS has this form: | ||
| 365 | |||
| 366 | (FACE FROM-THEME) | ||
| 393 | 367 | ||
| 394 | ARGS is defined as for `custom-theme-reset-faces'" | 368 | This means reset FACE to its value in FROM-THEME." |
| 395 | (apply 'custom-theme-reset-faces 'user args)) | 369 | (apply 'custom-theme-reset-faces 'user args)) |
| 396 | 370 | ||
| 397 | ;;; The End. | 371 | ;;; The End. |