[PATCH] Check 'x-resource is a specifier tag before passing it to map-specifier

Aidan Kehoe kehoea at parhasard.net
Mon Sep 24 04:39:10 EDT 2007


 Ar an ceathrú lá is fiche de mí Méan Fómhair, scríobh Stephen J. Turnbull: 

 > It's me FKtPp ;) writes:
 >  > Dear all,
 >  > 
 >  > The latest
 >  > 
 >  > ftp://ftp.xemacs.org/windows/testting/XEmacs_Setup_21.5-b28-2007-09-06.exe
 >  > 
 >  > in windows xp home edition will through out an 'unknown tag-set
 >  > x-resource' error when changing font size from menu.
 > 
 > Yo, Aidan!  This one's yours....

Thanks for the pointer! It's me FKtpP ;), could you test with this patch?

(I dislike the design of erroring when a specifier tag hasn't been seen; this
breaks run-time checks for, say, msprinter, for example. But that's the way
the design is right now.)

lisp/ChangeLog addition:

2007-09-24  Aidan Kehoe  <kehoea at parhasard.net>

	* font-menu.el (font-menu-set-font):
	Check 'x-resource is a specifier tag before passing it to
	map-specifier; prevents an error on pure MSW builds. 


XEmacs Trunk source patch:
Diff command:   cvs -q diff -u
Files affected: lisp/font-menu.el
===================================================================
RCS

Index: lisp/font-menu.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/font-menu.el,v
retrieving revision 1.10
diff -u -r1.10 font-menu.el
--- lisp/font-menu.el	2007/04/22 19:58:33	1.10
+++ lisp/font-menu.el	2007/09/24 08:33:28
@@ -367,25 +367,26 @@
 						     (selected-device))))
 			     "pt")))
             new-spec-list)
-        ;; If the font was initialised from X resources (the tag-set
-        ;; contains 'x-resource) pretend to Custom that it has
-        ;; responsibility for those settings.
-        (map-specifier (face-font 'default)
-                       (lambda (spec locale inst-list arg)
-                         (loop
-                           for (tag-set . inst)
-                           in inst-list
-                           do (setq tag-set (delq 'x-resource tag-set)
-                                    tag-set (delq 'custom tag-set)
-                                    tag-set (cons 'custom tag-set))
-                           (push (cons tag-set inst) new-spec-list)
-                           ;; Need to return nil, else map-specifier stops
-                           finally return nil))
-                       nil nil '(x-resource))
-        (remove-specifier (face-font 'default) nil '(x-resource))
-        (when new-spec-list
-          (add-spec-list-to-specifier (face-font 'default)
-                                      (list (cons 'global new-spec-list))))
+	(when (valid-specifier-tag-p 'x-resource)
+	  ;; If the font was initialised from X resources (the tag-set
+	  ;; contains 'x-resource) pretend to Custom that it has
+	  ;; responsibility for those settings.
+	  (map-specifier (face-font 'default)
+			 (lambda (spec locale inst-list arg)
+			   (loop
+			     for (tag-set . inst)
+			     in inst-list
+			     do (setq tag-set (delq 'x-resource tag-set)
+				      tag-set (delq 'custom tag-set)
+				      tag-set (cons 'custom tag-set))
+			     (push (cons tag-set inst) new-spec-list)
+			     ;; Need to return nil, else map-specifier stops
+			     finally return nil))
+			 nil nil '(x-resource))
+	  (remove-specifier (face-font 'default) nil '(x-resource))
+	  (when new-spec-list
+	    (add-spec-list-to-specifier (face-font 'default)
+					(list (cons 'global new-spec-list)))))
 	(custom-set-face-update-spec 'default
 				     (list (list 'type (device-type)))
 				     (list :family (or family from-family)

-- 
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)



More information about the XEmacs-Beta mailing list