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 20:13:15 -0700 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1147576426 7079 80.91.229.2 (14 May 2006 03:13:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 14 May 2006 03:13:46 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 14 05:13:43 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 1Ff734-0004AV-OB for ged-emacs-devel@m.gmane.org; Sun, 14 May 2006 05:13:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ff734-0006zB-8F for ged-emacs-devel@m.gmane.org; Sat, 13 May 2006 23:13:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ff72r-0006y7-8H for emacs-devel@gnu.org; Sat, 13 May 2006 23:13:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ff72o-0006x2-PL for emacs-devel@gnu.org; Sat, 13 May 2006 23:13:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ff72o-0006wz-GL for emacs-devel@gnu.org; Sat, 13 May 2006 23:13:22 -0400 Original-Received: from [148.87.113.118] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1Ff74u-0003tI-F1 for emacs-devel@gnu.org; Sat, 13 May 2006 23:15:32 -0400 Original-Received: from rgmsgw300.us.oracle.com (rgmsgw300.us.oracle.com [138.1.186.49]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id k4E3DJ4E017655 for ; Sat, 13 May 2006 21:13:19 -0600 Original-Received: from dradamslap (dhcp-amer-csvpn-gw1-141-144-64-240.vpn.oracle.com [141.144.64.240]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id k4E3DIgs010852 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sat, 13 May 2006 21:13:19 -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: 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:54424 Archived-At: > Why exactly do you want to do this? > > I thought I explained that.... Why does anyone want > to bind variables and functions, as opposed to using > `unwind-protect', assigning new definitions, and > restoring afterward? "By analogy with" isn't a very compelling reason for a feature. What I'm asking is: "What is a real-world problem where you would need such a thing?" Emacs-Lisp programming. Any situation where you might want to redefine a face only temporarily, for use in a particular context. Is that hard to imagine? My impression is that faces in general reflect a more permanent sort of state Precisely. You might want to change some properties of a face temporarily in a function, without affecting its "more permanent" nature. You might want to use existing code that employs a particular face (e.g. hard-coded - there are examples of `region' and `highlight' in the standard Emacs code, for instance), substituting another face, with different face properties, for it. You might want to use existing code that employs a face, but not have that face appear (be noticeable) at all. and that the idea of "binding" face definitions is a bit alien to the way they are used. There is not only one way that faces are used - "the way". Binding a face would be similar to binding a global variable. Like faces, many global variables (including most user options) have a "more permanent sort of state", but that doesn't mean it isn't useful sometimes to bind them to different values locally. It's precisely because we don't want to change the more permanent state of global variables that we bind them to new values instead of assigning them those values. Imagine that you had no `let' binding and you wanted to get a similar effect. You would use `unwind-protect', save the value, assign the new value, execute the body, and then restore the original value. That's where we are today with faces. "When you have only a hammer, everything looks like a nail", as they say. If there were no `let', there would be a lot less temporary changing of global variables (not worth the hassle; lack of appreciation of the possibility/need), and someone suggesting to add `let' would be asked "Why do you need that in the real world? Global variables have a permanent sort of state. That is a bit alien to the way they are used."