From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: how to save a face in Lisp? Date: Wed, 3 Oct 2007 07:55:16 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1191424949 24637 80.91.229.12 (3 Oct 2007 15:22:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 Oct 2007 15:22:29 +0000 (UTC) To: =?UTF-8?Q?Johan_=22Bockg=C3=A5rd=22?= , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 03 17:22:26 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Id63N-0007RQ-U2 for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Oct 2007 17:22:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Id63J-0007wm-Fe for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Oct 2007 11:22:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Id632-0007v6-Gi for help-gnu-emacs@gnu.org; Wed, 03 Oct 2007 11:22:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Id630-0007sJ-ST for help-gnu-emacs@gnu.org; Wed, 03 Oct 2007 11:22:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Id630-0007s6-Kh for help-gnu-emacs@gnu.org; Wed, 03 Oct 2007 11:22:02 -0400 Original-Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Id630-0006MR-Aw for help-gnu-emacs@gnu.org; Wed, 03 Oct 2007 11:22:02 -0400 Original-Received: from agmgw2.us.oracle.com (agmgw2.us.oracle.com [152.68.180.213]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l93FLhg9004032 for ; Wed, 3 Oct 2007 10:21:43 -0500 Original-Received: from acsmt350.oracle.com (acsmt350.oracle.com [141.146.40.150]) by agmgw2.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id l93FJp3M005985 for ; Wed, 3 Oct 2007 09:21:43 -0600 Original-Received: from dhcp-amer-csvpn-gw2-141-144-73-128.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 3263930711191423307; Wed, 03 Oct 2007 07:55:07 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-Detected-Kernel: Linux 2.4-2.6 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:48079 Archived-At: > > For example, suppose this is the definition of face `foo': > > > > (defface foo > > '((((background dark)) (:foreground "DarkGreen")) > > (t (:foreground "Red"))) > > "...") > > > > And suppose this has been evaluated, temporarily "customizing" the = face > > outside of Customize: > > > > (set-face-attribute 'foo nil :foreground "Yellow") > > > > And suppose that the background mode is not `dark'. Then the=20 > > spec that needs to be written if this face is saved is this: > > > > '((((background dark)) (:foreground "DarkGreen")) > > (t (:foreground "Yellow"))) >=20 > (set-face-attribute FACE nil ...) overrides all other settings of = FACE, > so I don't think the `(background dark)' part should be saved. Regardless of the fact that `set-face-attribute' does that for the = current session, I want the effect to be exactly what it would be "if = the face had been modified by the user in Customize and saved by the = user in Customize." But perhaps even in the latter case only the equivalent of the = `set-face-attribute' effect is saved, not the whole (updated) spec. I = was thinking that what was in the custom file was a complete defface = spec that covers all background modes that were defined in the original = defface spec, but it looks like it is just the part of that spec that = the user actually customized. However, it does include the entire alist entry (DISPLAY ATTS), not just = ATTS. Here, for example, is a spec from my `custom-file': '(link ((((class color) (min-colors 88) (background light)) (:foreground "blue1")))) `face-attr-construct' gives me only ATTS. In this case, it would give me = only (:foreground "blue1"). Depending on what the ATTS are, it would be possible to look up the = corresponding DISPLAY in `face-user-default-spec'. Or I could try to = construct DISPLAY from the current background mode and terminal type = (color support etc.), but there is no way, without consulting the spec = from `face-user-default-spec', to know whether DISPLAY should be `t' or, = say, ((class color) (min-colors 88) (background light)). I'm surprised that customizing in a currently light-background session = would lose any dark-background information for the customized face. That = doesn't seem right. You might want to use the same custom-file in = different settings, with different background modes.