From xemacs-m  Sun Feb 23 12:25:44 1997
Received: from jens.metrix.de (jens@jens.metrix.de [194.123.88.124])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id MAA10219
	for <xemacs-beta@xemacs.org>; Sun, 23 Feb 1997 12:25:42 -0600 (CST)
Received: (from jens@localhost) by jens.metrix.de (8.7.6/8.7.3) id TAA07583; Sun, 23 Feb 1997 19:25:34 +0100
To: xemacs-beta@xemacs.org
Subject: Edit-faces: RFC and patch against b95
X-Face: Z[@OB)("ZvE?ev~1b+b!0ZUB.$%rh.9qE>dVf>q}Q/V?%d`J3gd!LR\aAZ8<Hwi]xTA(:*c;i3,?K?+rCy*^b$)a,}E?eo},}x2]5LlJysyoUOK"o[>K)'\Ulb7y-7*.If^;rHl['oa)n_M7E6w+LDKMs"G8_`c)uOS1^}.1|8Ill]7X68X-paeUOpBhz<F`B0?~^2Et~GYfw~/0]H]nx4~C_E/_mp#^7Ixc:
Reply-To: jens@lemming0.lem.uni-karlsruhe.de
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: multipart/mixed;
 boundary="Multipart_Sun_Feb_23_19:25:32_1997-1"
Content-Transfer-Encoding: 7bit
From: Jens Lautenbacher <jens@metrix.de>
Date: 23 Feb 1997 19:25:33 +0100
Message-ID: <m3zpwv5qhu.fsf@jens.metrix.de>
Lines: 156
X-Mailer: Gnus v5.4.15/XEmacs 19.15

--Multipart_Sun_Feb_23_19:25:32_1997-1
Content-Type: text/plain; charset=US-ASCII


Hi all,

I made a quick hack to provide for a better alternative to edit-faces.
As it stands now, it is completely unusuable IMHO. One of the very
important things about faces is that they need only be 'partial'
defined, e.g. zmacs region has only the backgound set but nothing
else. If you change any face with edit-faces the complete current
definition will be saved. The net result is that zmacs-region will now
be defined e.g. background gey75, foreground black, family courier, no
bold, no italic etc. with these definitions all being inherited from
'default. If used now to mark a region which is in helvetica 24
point... You see my point... :-)

But we have a *better* alternative now: *custom* !!

Of course most of the faces are still not prepared for custom, but
that doesn't prohibit to set them anyway with the help of custom.
I do all my faces this way.

The following patch provides for two things:

    a) I patches x-menubar.el to respect a variable options-save-faces
       which tells save-options if it should save face-information or
       not. I really ned this as I don't want save-options destroy my
       customized face settings but on the other hand still want to be
       able to save other options. You need to redump XEmacs

    b) I give a new definiton of edit-faces which can simply be put
       into one's .emacs to get the new functionality.

IMHO this way is the only currently available one for really hacking
with faces. _Please_ _consider_ _making_ _this_ _the_ _default_....


First of all, the excerpt from my .emacs...

--------------------------------------------------
       (setq options-save-faces nil) ;; we don't want faces to be
                                     ;; saved via "Save Options" 
  
       (defun edit-faces ()
	 (interactive)
	 (let (tmp-list elem available-faces)
	   (require 'custom)
	   (require 'cl)
	   (setq tmp-list (sort (list-faces)
				'(lambda (one two)
				   (if (string< (symbol-name one)
						(symbol-name two)) t
				     nil))))
	   (defgroup available-faces nil
	     "All faces that are currently known to the system.")
	   (while (setq elem (pop tmp-list))
	     (custom-add-to-group 'available-faces elem 'custom-face))
	   (message "Please stand by while generating list of faces...")
	   (customize 'available-faces)))
---------------------------------------------------       

And now the patch....


--Multipart_Sun_Feb_23_19:25:32_1997-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="faceopt.patch"
Content-Transfer-Encoding: 7bit

*** x-menubar.el.old	Sun Feb 23 19:05:15 1997
--- x-menubar.el	Sun Feb 23 19:21:14 1997
***************
*** 1012,1017 ****
--- 1012,1021 ----
  ;;; The Options menu
  (defvar save-options-font-hack nil)
  
+ (defvar options-save-faces t
+   "if t, save-options will save all the face information.
+ Set to nil to avoid this.")
+ 
  (defconst options-menu-saved-forms
    ;; This is really quite a kludge, but it gets the job done.
    ;;
***************
*** 1138,1167 ****
       ;; Setting this in lisp conflicts with X resources.  Bad move.  --Stig 
       ;; (list 'set-face-font ''default (face-font-name 'default))
       ;; (list 'set-face-font ''modeline (face-font-name 'modeline))
! 
!      (cons 'progn
! 	   (mapcar #'(lambda (face)
! 		       `(make-face ',face))
! 		   (face-list)))
! 
!      (cons 'progn
! 	   (apply 'nconc
! 		  (mapcar
! 		   #'(lambda (face)
! 		       (delq nil
! 			     (mapcar
! 			      #'(lambda (property)
! 				  (if (specifier-spec-list
! 				       (face-property face property))
! 				      `(add-spec-list-to-specifier
! 					(face-property ',face ',property)
! 					',(save-options-specifier-spec-list
! 					   face property))))
! 			      (delq 'display-table
! 				    (copy-sequence
! 				     built-in-face-specifiers)))))
! 		   (face-list))))
! 
       ))
    "The variables to save; or forms to evaluate to get forms to write out.
  This is used by `save-options-menu-settings' and should mirror the
--- 1142,1172 ----
       ;; Setting this in lisp conflicts with X resources.  Bad move.  --Stig 
       ;; (list 'set-face-font ''default (face-font-name 'default))
       ;; (list 'set-face-font ''modeline (face-font-name 'modeline))
!      (if options-save-faces
! 	 (cons 'progn
! 	       (mapcar #'(lambda (face)
! 			   `(make-face ',face))
! 		       (face-list))))
!      
!      (if options-save-faces
! 	 (cons 'progn
! 	       (apply 'nconc
! 		      (mapcar
! 		       #'(lambda (face)
! 			   (delq nil
! 				 (mapcar
! 				  #'(lambda (property)
! 				      (if (specifier-spec-list
! 					   (face-property face property))
! 					  `(add-spec-list-to-specifier
! 					    (face-property ',face ',property)
! 					    ',(save-options-specifier-spec-list
! 					       face property))))
! 				  (delq 'display-table
! 					(copy-sequence
! 					 built-in-face-specifiers)))))
! 		       (face-list)))))
!      
       ))
    "The variables to save; or forms to evaluate to get forms to write out.
  This is used by `save-options-menu-settings' and should mirror the

--Multipart_Sun_Feb_23_19:25:32_1997-1
Content-Type: text/plain; charset=US-ASCII



--Multipart_Sun_Feb_23_19:25:32_1997-1--

