]> git.eshelyaron.com Git - emacs.git/commitdiff
(frame-set-background-mode): Avoid stomping on locally modified faces.
authorMiles Bader <miles@gnu.org>
Wed, 6 Dec 2000 05:11:20 +0000 (05:11 +0000)
committerMiles Bader <miles@gnu.org>
Wed, 6 Dec 2000 05:11:20 +0000 (05:11 +0000)
lisp/ChangeLog
lisp/faces.el

index e0fcec8b17ad1062f9e974020175770b52efd86a..4dd7634877591e1274501f83493852cadb516094 100644 (file)
@@ -1,3 +1,8 @@
+2000-12-06  Miles Bader  <miles@gnu.org>
+
+       * faces.el (frame-set-background-mode): Avoid stomping on
+       locally modified faces.
+
 2000-12-06  Kenichi Handa  <handa@etl.go.jp>
 
        * international/fontset.el: Correct the font registries for
index 4c59a220ac60243e9c1e25d22dacc989e41c38fa..9821be0736203af0621cc75c23273fe8c49b55a8 100644 (file)
@@ -1395,13 +1395,26 @@ according to the `background-mode' and `display-type' frame parameters."
          (frame-parameter frame 'display-type)))
 
     (unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type))
-      (modify-frame-parameters frame
-                              (list (cons 'background-mode bg-mode)
-                                    (cons 'display-type display-type)))
-      ;; For all named faces, choose face specs matching the new frame
-      ;; parameters.
-      (dolist (face (face-list))
-       (face-spec-set face (face-user-default-spec face) frame)))))
+      (let ((locally-modified-faces nil))
+       ;; Before modifying the frame parameters, we collect a list of
+       ;; faces that don't match what their face-spec says they should
+       ;; look like; we then avoid changing these faces below.  A
+       ;; negative list is used on the assumption that most faces will
+       ;; be unmodified, so we can avoid consing in the common case.
+       (dolist (face (face-list))
+         (when (not (face-spec-match-p face
+                                       (face-user-default-spec face)
+                                       (selected-frame)))
+           (push face locally-modified-faces)))
+       ;; Now change to the new frame parameters
+       (modify-frame-parameters frame
+                                (list (cons 'background-mode bg-mode)
+                                      (cons 'display-type display-type)))
+       ;; For all named faces, choose face specs matching the new frame
+       ;; parameters, unless they have been locally modified.
+       (dolist (face (face-list))
+         (unless (memq face locally-modified-faces)
+           (face-spec-set face (face-user-default-spec face) frame)))))))
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;