aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-12-06 05:11:20 +0000
committerMiles Bader2000-12-06 05:11:20 +0000
commit6e4240195f5d2efeaacf94bfdd6efb80709e0a95 (patch)
tree38fee4f75982f792c61c583eb22b6bb52a4890ec
parentdd7e81b40458c16fdb592e873b1b551fb110e6af (diff)
downloademacs-6e4240195f5d2efeaacf94bfdd6efb80709e0a95.tar.gz
emacs-6e4240195f5d2efeaacf94bfdd6efb80709e0a95.zip
(frame-set-background-mode): Avoid stomping on locally modified faces.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/faces.el27
2 files changed, 25 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e0fcec8b17a..4dd76348775 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12000-12-06 Miles Bader <miles@gnu.org>
2
3 * faces.el (frame-set-background-mode): Avoid stomping on
4 locally modified faces.
5
12000-12-06 Kenichi Handa <handa@etl.go.jp> 62000-12-06 Kenichi Handa <handa@etl.go.jp>
2 7
3 * international/fontset.el: Correct the font registries for 8 * international/fontset.el: Correct the font registries for
diff --git a/lisp/faces.el b/lisp/faces.el
index 4c59a220ac6..9821be07362 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1395,13 +1395,26 @@ according to the `background-mode' and `display-type' frame parameters."
1395 (frame-parameter frame 'display-type))) 1395 (frame-parameter frame 'display-type)))
1396 1396
1397 (unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type)) 1397 (unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type))
1398 (modify-frame-parameters frame 1398 (let ((locally-modified-faces nil))
1399 (list (cons 'background-mode bg-mode) 1399 ;; Before modifying the frame parameters, we collect a list of
1400 (cons 'display-type display-type))) 1400 ;; faces that don't match what their face-spec says they should
1401 ;; For all named faces, choose face specs matching the new frame 1401 ;; look like; we then avoid changing these faces below. A
1402 ;; parameters. 1402 ;; negative list is used on the assumption that most faces will
1403 (dolist (face (face-list)) 1403 ;; be unmodified, so we can avoid consing in the common case.
1404 (face-spec-set face (face-user-default-spec face) frame))))) 1404 (dolist (face (face-list))
1405 (when (not (face-spec-match-p face
1406 (face-user-default-spec face)
1407 (selected-frame)))
1408 (push face locally-modified-faces)))
1409 ;; Now change to the new frame parameters
1410 (modify-frame-parameters frame
1411 (list (cons 'background-mode bg-mode)
1412 (cons 'display-type display-type)))
1413 ;; For all named faces, choose face specs matching the new frame
1414 ;; parameters, unless they have been locally modified.
1415 (dolist (face (face-list))
1416 (unless (memq face locally-modified-faces)
1417 (face-spec-set face (face-user-default-spec face) frame)))))))
1405 1418
1406 1419
1407;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1420;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;