]> code.delx.au - gnu-emacs/blobdiff - lisp/dynamic-setting.el
Fix an instance of dynamic-setting.el clobbering the default face.
[gnu-emacs] / lisp / dynamic-setting.el
index 37a959995628742f9bad232793b8f56116d729c2..e04af7800fccadd0a5044c80c044293165ebebb1 100644 (file)
@@ -1,10 +1,11 @@
 ;;; dynamic-setting.el --- Support dynamic changes
 
-;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2012 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <jan.h.d@swipnet.se>
 ;; Maintainer: FSF
 ;; Keywords: font, system-font, tool-bar-style
+;; Package: emacs
 
 ;; This file is part of GNU Emacs.
 
@@ -65,7 +66,6 @@ current form for the frame (i.e. hinting or somesuch changed)."
                      frame-font)))
              (if font-to-set
                  (progn
-                   (message "setting %s" font-to-set)
                    (set-frame-parameter f 'font-parameter font-to-set)
                    (set-face-attribute 'default f
                                        :width 'normal
@@ -74,9 +74,10 @@ current form for the frame (i.e. hinting or somesuch changed)."
                                        :font font-to-set))))))
 
       ;; Set for future frames.
-      (set-face-attribute 'default t :font new-font)
-      (let ((spec (list (list t (face-attr-construct 'default)))))
-       (progn
+      (when set-font
+       ;; FIXME: this is not going to play well with Custom themes.
+       (set-face-attribute 'default t :font new-font)
+       (let ((spec (list (list t (face-attr-construct 'default)))))
          (put 'default 'customized-face spec)
          (custom-push-theme 'theme-face 'default 'user 'set spec)
          (put 'default 'face-modified nil))))))
@@ -86,7 +87,9 @@ current form for the frame (i.e. hinting or somesuch changed)."
 Changes can be
   The monospace font. If `font-use-system-font' is nil, the font
     is not changed.
+  The normal font.
   Xft parameters, like DPI and hinting.
+  The Gtk+ theme name.
   The tool bar style."
   (interactive "e")
   (let ((type (nth 1 event))
@@ -97,9 +100,13 @@ Changes can be
          ((eq type 'font-render)
           (font-setting-change-default-font display-name nil))
 
+         ;; This is a bit heavy, ideally we would just clear faces
+         ;; on the affected display, and perhaps only the relevant
+         ;; faces.  Oh well.
+         ((eq type 'theme-name) (clear-face-cache))
+
          ((eq type 'tool-bar-style) (force-mode-line-update t)))))
 
 (define-key special-event-map [config-changed-event]
   'dynamic-setting-handle-config-changed-event)
 
-;; arch-tag: 3a57e78f-1cd6-48b6-ab75-98f160dcc017