From xemacs-m  Mon Mar  3 11:49:35 1997
Received: from elc1.dina.kvl.dk (elc1.dina.kvl.dk [130.225.40.228])
	by xemacs.org (8.8.5/8.8.5) with SMTP id LAA19552
	for <xemacs-beta@xemacs.org>; Mon, 3 Mar 1997 11:49:28 -0600 (CST)
Received: from zuse.dina.kvl.dk (zuse.dina.kvl.dk [130.225.40.245]) by elc1.dina.kvl.dk (8.6.12/8.6.4) with ESMTP id SAA12951; Mon, 3 Mar 1997 18:38:41 +0100
Received: (abraham@localhost) by zuse.dina.kvl.dk (8.6.12/8.6.4) id SAA13441; Mon, 3 Mar 1997 18:47:29 +0100
Sender: abraham@dina.kvl.dk
To: xemacs-beta@xemacs.org
Subject: Patch to x-faces.el to implement `make-face-x-resource-internal'.
Organization: The Church of Emacs
X-Face: +kRV2]2q}lixHkE{U)mY#+6]{AH=yN~S9@IFiOa@X6?GM<U{B+4e{k79.Ya{~':DblFPCg$
 @60,BfLv2@SKZ19cMWK0/C'v;tM:|6B'R}U1rp6CL&kN({9<zF/V{:JCg27yC)9oZjeqcQawzKfiNL
 t9}`vjmK["dRQC/qGFQq"%u|Q`:6{"Rz}b(dnl_"3$Jtqimi>|8MBp/
From: Per Abrahamsen <abraham@dina.kvl.dk>
Date: 03 Mar 1997 18:47:29 +0100
Message-ID: <rjg1yc6f66.fsf@zuse.dina.kvl.dk>
Lines: 119
X-Mailer: Gnus v5.4.17/Emacs 19.34
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit


In custom.el I need a way to overwrite a face according to the X
resources.  In Emacs, I can do this with an optional third argument to
`make-face-x-resource-internal'.  The equivalent function in XEmacs is
`x-init-face-from-resources'.  This patch adds the extra argument, and
makes `make-face-x-resource-internal' an alias.

PS: If there is a function to create a face _without_ looking up
attributes in the X resources database, I could use that to speed up
things, especially for people with slow X connections.

Mon Mar  3 17:50:04 1997  Per Abrahamsen  <abraham@dina.kvl.dk>

	* x11/x-faces.el (x-init-face-from-resources): Made second
	argument optional, and added a third argument.
	(make-face-x-resource-internal): New alias.

*** src/xemacs-20.0/lisp/x11/x-faces.el	Wed Dec 18 23:43:05 1996
--- lib/xemacs-20.0/lisp/x11/x-faces.el	Mon Mar  3 18:03:03 1997
***************
*** 372,378 ****
  ;;; state where signalling an error or entering the debugger would likely
  ;;; result in a crash.
  
! (defun x-init-face-from-resources (face locale)
    ;;
    ;; These are things like "attributeForeground" instead of simply
    ;; "foreground" because people tend to do things like "*foreground",
--- 372,379 ----
  ;;; state where signalling an error or entering the debugger would likely
  ;;; result in a crash.
  
! (defun x-init-face-from-resources (face &optional locale set-anyway)
! 
    ;;
    ;; These are things like "attributeForeground" instead of simply
    ;; "foreground" because people tend to do things like "*foreground",
***************
*** 385,391 ****
    ;; "face.attributeForeground", but they're the way they are for
    ;; hysterical reasons. (jwz)
  
!   (let* ((face-sym (face-name face))
  	 (name (symbol-name face-sym))
  	 (fn (x-get-resource-and-maybe-bogosity-check
  	      (concat name ".attributeFont")
--- 386,393 ----
    ;; "face.attributeForeground", but they're the way they are for
    ;; hysterical reasons. (jwz)
  
!   (let* ((append (if set-anyway nil 'append))
! 	 (face-sym (face-name face))
  	 (name (symbol-name face-sym))
  	 (fn (x-get-resource-and-maybe-bogosity-check
  	      (concat name ".attributeFont")
***************
*** 460,488 ****
      ;; done when the instancing actually happens, but I'm not
      ;; sure how it should actually be dealt with.
      (if fn
! 	(set-face-font face fn locale nil 'append))
      ;; Kludge-o-rooni.  Set the foreground and background resources for
      ;; X devices only -- otherwise things tend to get all messed up
      ;; if you start up an X frame and then later create a TTY frame.
      (if fg
! 	(set-face-foreground face fg locale 'x 'append))
      (if bg
! 	(set-face-background face bg locale 'x 'append))
      (if bgp
! 	(set-face-background-pixmap face bgp locale nil 'append))
      (if ulp
! 	(set-face-underline-p face ulp locale nil 'append))
      (if stp
! 	(set-face-strikethru-p face stp locale nil 'append))
      (if hp
! 	(set-face-highlight-p face hp locale nil 'append))
      (if dp
! 	(set-face-dim-p face dp locale nil 'append))
      (if bp
! 	(set-face-blinking-p face bp locale nil 'append))
      (if rp
! 	(set-face-reverse-p face rp locale nil 'append))
      ))
  
  ;;; x-init-global-faces is responsible for ensuring that the
  ;;; default face has some reasonable fallbacks if nothing else is
--- 462,493 ----
      ;; done when the instancing actually happens, but I'm not
      ;; sure how it should actually be dealt with.
      (if fn
! 	(set-face-font face fn locale nil append))
      ;; Kludge-o-rooni.  Set the foreground and background resources for
      ;; X devices only -- otherwise things tend to get all messed up
      ;; if you start up an X frame and then later create a TTY frame.
      (if fg
! 	(set-face-foreground face fg locale 'x append))
      (if bg
! 	(set-face-background face bg locale 'x append))
      (if bgp
! 	(set-face-background-pixmap face bgp locale nil append))
      (if ulp
! 	(set-face-underline-p face ulp locale nil append))
      (if stp
! 	(set-face-strikethru-p face stp locale nil append))
      (if hp
! 	(set-face-highlight-p face hp locale nil append))
      (if dp
! 	(set-face-dim-p face dp locale nil append))
      (if bp
! 	(set-face-blinking-p face bp locale nil append))
      (if rp
! 	(set-face-reverse-p face rp locale nil append))
      ))
+ 
+ ;; GNU Emacs compatibility. (move to obsolete.el?)
+ (defalias 'make-face-x-resource-internal 'x-init-face-from-resources)
  
  ;;; x-init-global-faces is responsible for ensuring that the
  ;;; default face has some reasonable fallbacks if nothing else is

