diff options
| -rw-r--r-- | lisp/faces.el | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index dbe90c75060..4ecead6a32f 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -293,25 +293,31 @@ If the face already exists, it is unmodified." | |||
| 293 | ))) | 293 | ))) |
| 294 | face) | 294 | face) |
| 295 | 295 | ||
| 296 | (defun copy-face (old-face new-name &optional frame new-frame) | 296 | (defun copy-face (old-face new-face &optional frame new-frame) |
| 297 | "Define a face just like OLD-FACE, with name NEW-NAME. | 297 | "Define a face just like OLD-FACE, with name NEW-FACE. |
| 298 | If NEW-NAME already exists as a face, it is modified to be like OLD-FACE. | 298 | If NEW-FACE already exists as a face, it is modified to be like OLD-FACE. |
| 299 | If the optional argument FRAME is given, this applies only to that frame. | 299 | If it doesn't already exist, it is created. |
| 300 | Otherwise it applies to each frame separately. | 300 | |
| 301 | If the optional argument FRAME is given as a frame, | ||
| 302 | NEW-FACE is changed on FRAME only. | ||
| 303 | If FRAME is t, the frame-independent default specification for OLD-FACE | ||
| 304 | is copied to NEW-FACE. | ||
| 305 | If FRAME is nil, copying is done for the frame-independent defaults | ||
| 306 | and for each existing frame. | ||
| 301 | If the optional fourth argument NEW-FRAME is given, | 307 | If the optional fourth argument NEW-FRAME is given, |
| 302 | copy the information from face OLD-FACE on frame FRAME | 308 | copy the information from face OLD-FACE on frame FRAME |
| 303 | to face NEW-NAME on frame NEW-FRAME." | 309 | to NEW-FACE on frame NEW-FRAME." |
| 304 | (or new-frame (setq new-frame frame)) | 310 | (or new-frame (setq new-frame frame)) |
| 305 | (setq old-face (internal-get-face old-face frame)) | 311 | (setq old-face (internal-get-face old-face frame)) |
| 306 | (let* ((inhibit-quit t) | 312 | (let* ((inhibit-quit t) |
| 307 | (new-face (or (internal-find-face new-name new-frame) | 313 | (new-face (or (internal-find-face new-face new-frame) |
| 308 | (make-face new-name)))) | 314 | (make-face new-face)))) |
| 309 | (if (null frame) | 315 | (if (null frame) |
| 310 | (let ((frames (frame-list))) | 316 | (let ((frames (frame-list))) |
| 311 | (while frames | 317 | (while frames |
| 312 | (copy-face old-face new-name (car frames)) | 318 | (copy-face old-face new-face (car frames)) |
| 313 | (setq frames (cdr frames))) | 319 | (setq frames (cdr frames))) |
| 314 | (copy-face old-face new-name t)) | 320 | (copy-face old-face new-face t)) |
| 315 | (set-face-font new-face (face-font old-face frame) new-frame) | 321 | (set-face-font new-face (face-font old-face frame) new-frame) |
| 316 | (set-face-foreground new-face (face-foreground old-face frame) new-frame) | 322 | (set-face-foreground new-face (face-foreground old-face frame) new-frame) |
| 317 | (set-face-background new-face (face-background old-face frame) new-frame) | 323 | (set-face-background new-face (face-background old-face frame) new-frame) |