xsettings.c didn't check font-use-system-font, fix that.
authorJan Djärv <jan.h.d@swipnet.se>
Tue, 17 Nov 2009 20:17:46 +0000 (20:17 +0000)
committerJan Djärv <jan.h.d@swipnet.se>
Tue, 17 Nov 2009 20:17:46 +0000 (20:17 +0000)
* xsettings.c (something_changedCB, Ffont_get_system_font): Check
use_system_font.
(syms_of_xsettings): DEFVAR font-use-system-font.

* font-setting.el (font-use-system-font): Moved ...

* cus-start.el (all): ... to here.

lisp/ChangeLog
lisp/cus-start.el
lisp/font-setting.el
src/ChangeLog
src/xsettings.c

index b375819..3b3b51a 100644 (file)
@@ -1,3 +1,9 @@
+2009-11-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * font-setting.el (font-use-system-font): Moved ...
+
+       * cus-start.el (all): ... to here.
+
 2009-11-17  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp.el (tramp-advice-file-expand-wildcards): Simplify.
index 970431d..76acd7e 100644 (file)
@@ -351,7 +351,9 @@ since it could result in memory overflow and make Emacs crash."
             ;; xterm.c
             (x-use-underline-position-properties display boolean "22.1")
             (x-underline-at-descent-line display boolean "22.1")
-            (x-stretch-cursor display boolean "21.1")))
+            (x-stretch-cursor display boolean "21.1")
+            ;; xsettings.c
+            (font-use-system-font font-selection boolean "23.2")))
       this symbol group type standard version native-p
       ;; This function turns a value
       ;; into an expression which produces that value.
index f426a14..51cf137 100644 (file)
 
 ;;; Customizable variables
 
-(defun font-setting-set-system-font (symbol value)
-  (set-default symbol value)
-  (if (symbol-value symbol)
-      (let ((f (selected-frame)))
-       (if (display-graphic-p f)
-           (font-setting-change-default-font f t)))))
-
-(defcustom font-use-system-font nil
-  "If non-nil, use the system monospaced font"
-  :version "23.2"
-  :type 'boolean
-  :group 'font-selection
-  :set 'font-setting-set-system-font)
-
 (declare-function font-get-system-font "xsettings.c" ())
 
 (defun font-setting-change-default-font (display-or-frame set-font)
@@ -75,13 +61,15 @@ current form for the frame (i.e. hinting or somesuch changed)."
                    (if set-font new-font
                      ;; else set font again, hinting etc. may have changed.
                      frame-font)))
-             (progn
-               (set-frame-parameter f 'font-parameter font-to-set)
-               (set-face-attribute 'default f 
-                                   :width 'normal
-                                   :weight 'normal
-                                   :slant 'normal
-                                   :font font-to-set)))))
+             (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
+                                       :weight 'normal
+                                       :slant 'normal
+                                       :font font-to-set))))))
     
       ;; Set for future frames.
       (set-face-attribute 'default t :font new-font)
index ef97e09..4b3b64f 100644 (file)
@@ -1,3 +1,9 @@
+2009-11-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xsettings.c (something_changedCB, Ffont_get_system_font): Check
+       use_system_font.
+       (syms_of_xsettings): DEFVAR font-use-system-font.
+
 2009-11-17  Andreas Schwab  <schwab@linux-m68k.org>
 
        * xfns.c (x_default_font_parameter): Remove dead assignment.
index 99ddd00..71a7eaa 100644 (file)
@@ -40,6 +40,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 static char *current_mono_font;
 static struct x_display_info *first_dpyinfo;
 static Lisp_Object Qfont_name, Qfont_render;
+static int use_system_font;
 
 #ifdef HAVE_GCONF
 static GConfClient *gconf_client;
@@ -96,7 +97,7 @@ something_changedCB (client, cnxn_id, entry, user_data)
       for (dpyinfo = x_display_list; !found && dpyinfo; dpyinfo = dpyinfo->next)
         found = dpyinfo == first_dpyinfo;
 
-      if (found)
+      if (found && use_system_font)
         store_font_changed_event (Qfont_name,
                                   XCAR (first_dpyinfo->name_list_element));
     }
@@ -610,7 +611,7 @@ DEFUN ("font-get-system-font", Ffont_get_system_font, Sfont_get_system_font,
        doc: /* Get the system default monospaced font. */)
   ()
 {
-  return current_mono_font
+  return current_mono_font && use_system_font
     ? make_string (current_mono_font, strlen (current_mono_font))
     : Qnil;
 }
@@ -630,6 +631,10 @@ syms_of_xsettings ()
   staticpro (&Qfont_render);
   defsubr (&Sfont_get_system_font);
 
+  DEFVAR_BOOL ("font-use-system-font", &use_system_font,
+    doc: /* *Non-nil means to use the system defined font.  */);
+  use_system_font = 0;
+
 #ifdef HAVE_GCONF
   Fprovide (intern_c_string ("system-font-setting"), Qnil);
 #endif