From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: bind faces? Date: Sat, 13 May 2006 12:40:17 -0700 Message-ID: References: <877j4pbxxe.fsf@mit.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1147549254 14988 80.91.229.2 (13 May 2006 19:40:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 13 May 2006 19:40:54 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 13 21:40:49 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fezyh-0006W5-VZ for ged-emacs-devel@m.gmane.org; Sat, 13 May 2006 21:40:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fezyh-0006RH-ID for ged-emacs-devel@m.gmane.org; Sat, 13 May 2006 15:40:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FezyT-0006Qu-TF for emacs-devel@gnu.org; Sat, 13 May 2006 15:40:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FezyS-0006QH-AF for emacs-devel@gnu.org; Sat, 13 May 2006 15:40:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FezyS-0006Q8-5U for emacs-devel@gnu.org; Sat, 13 May 2006 15:40:24 -0400 Original-Received: from [141.146.126.228] (helo=agminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1Ff00T-0003p6-Op for emacs-devel@gnu.org; Sat, 13 May 2006 15:42:29 -0400 Original-Received: from rgmsgw300.us.oracle.com (rgmsgw300.us.oracle.com [138.1.186.49]) by agminet01.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id k4DJeMbQ012062 for ; Sat, 13 May 2006 14:40:22 -0500 Original-Received: from dradamslap (dhcp-amer-csvpn-gw1-141-144-64-178.vpn.oracle.com [141.144.64.178]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id k4DJeLqd003764 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sat, 13 May 2006 13:40:22 -0600 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-reply-to: <877j4pbxxe.fsf@mit.edu> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:54396 Archived-At: > Is there some way to get the effect of "binding" a face to a > list of face properties or the properties of another face? > That is, do something akin to this: > > (let ((some-face another-face-or-a-list-of-face-properties)) > (do-something)) > > Wouldn't it be useful to be able to do that? We have `let' > for variables and `flet' (via cl.el) for functions, but > nothing for faces, IIUC. (Obviously, a user could work with > face variables, but those are not always available and > their use is generally discouraged.) See face-default-spec, face-spec-set, and the other functions in faces.el. Yes, thanks. They can help with saving a face's attributes (spec), setting the attributes to those of another face (or a constructed spec), and then restoring the face's original attributes. But, IIUC, you would still need to do unwind-protect, save the current spec, set to another spec, and restore current spec. It's not clear to me how they would provide the convenience of a `let'. One could write one's own macro to do that (via unwind-protect), but why not have Emacs provide that? I'm also not clear on how to use those functions to make a face "unnoticeable", but that's because I'm not sure which face spec to use to do that. Would it be just this, or is there some general way to nullify all pertinent face properties? ((t (:foreground nil) (:background nil))) I've been using this, which does the job (but it doesn't take into account other face properties, such as underline): (set-face-foreground 'the-face nil) (set-face-background 'the-face nil)