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: Sun, 14 May 2006 07:32:09 -0700 Message-ID: References: <87mzdkrbte.fsf-monnier+emacs@gnu.org> 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 1147617160 30594 80.91.229.2 (14 May 2006 14:32:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 14 May 2006 14:32:40 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 14 16:32:38 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 1FfHe8-000726-44 for ged-emacs-devel@m.gmane.org; Sun, 14 May 2006 16:32:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FfHe7-0002uF-KO for ged-emacs-devel@m.gmane.org; Sun, 14 May 2006 10:32:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FfHdv-0002sL-0V for emacs-devel@gnu.org; Sun, 14 May 2006 10:32:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FfHdr-0002s6-FY for emacs-devel@gnu.org; Sun, 14 May 2006 10:32:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FfHdr-0002s3-AL for emacs-devel@gnu.org; Sun, 14 May 2006 10:32:19 -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 1FfHg3-00078C-Us for emacs-devel@gnu.org; Sun, 14 May 2006 10:34:36 -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 k4EEWGUc021004 for ; Sun, 14 May 2006 08:32:17 -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 k4EEWFo4009129 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sun, 14 May 2006 08:32:16 -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: <87mzdkrbte.fsf-monnier+emacs@gnu.org> 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:54442 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)) I'm not sure what you expect this to do. The lookup to map face names to visual properties is done (repeatedly) during redisplay, so would your let-face binding only affect the visual appearance of the face in the redisplays that take place during `do-something' or would you want the effect to outlive the let? I'm not sure I understand (I'm no expert on faces or displaying). Could you elaborate on the first part of that sentence? Are you saying that adding the face to some text wouldn't be reflected visually until redisplay takes place, and that might not happen until after the let is exited? Or are you saying something else? For the second part of the sentence, IIUC, I would not expect the face to reflect the new definition after the let is exited. E.g. in the code below: (let-face ((font-lock-string-face :background "red")) (put-text-property 1 5 'face 'font-lock-string-face)) do you expect the chars 1-5 to end up with a red background? If so, it's going to be difficult, because the whole put-text-property expression doesn't currently know it's manipulating any kind of face. I'm guessing that you mean that put-text-property would make chars 1-5 have font-lock-string-face (which would be defined at that point to have a red background), but those chars wouldn't get redisplayed until after the let is exited. If that's the case, then I'd say that users can use let to bind the face to a new definition, and they can use put-text-property to add that (newly defined) face to text, but they also need to (do something to) force redisplay inside the let, if they want to see the effect. Again, I'm no expert on this, so I don't know how this should be implemented (assuming I'm understanding the problem). If face definition and application to text are separated from redisplay (manifestation of the face change) in Emacs, then that fact will need to be taken into account. Either redisplay would need to be done automatically (but when?) or users would need to take care of redisplay themselves. The latter sounds fine to me (IIUC). Would (sit-for 0) or (force-mode-line-update) accomplish that? That is, could a user take care of the problem by simply doing this? (let-face ((font-lock-string-face :background "red")) (put-text-property 1 5 'face 'font-lock-string-face) ... (force-mode-line-update) ; Redisplay now. ... ) If I'm not understanding you well, perhaps you can elaborate a bit on the problem and possible alternatives.