From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#13278: 24.3.50; Attributes aren't inherited in a copied face across frames Date: Mon, 31 Dec 2012 12:03:15 +0800 Message-ID: <87fw2mvpfg.fsf@gnu.org> References: <87623kjkpo.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1356926646 29484 80.91.229.3 (31 Dec 2012 04:04:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 31 Dec 2012 04:04:06 +0000 (UTC) Cc: 13278-done@debbugs.gnu.org To: Katsumi Yamaoka Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 31 05:04:20 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TpWbr-0003Wa-Qs for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Dec 2012 05:04:20 +0100 Original-Received: from localhost ([::1]:35074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TpWbc-0006iL-VJ for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Dec 2012 23:04:04 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TpWbY-0006hc-CG for bug-gnu-emacs@gnu.org; Sun, 30 Dec 2012 23:04:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TpWbT-0003xI-Vh for bug-gnu-emacs@gnu.org; Sun, 30 Dec 2012 23:04:00 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TpWbT-0003xE-Rb for bug-gnu-emacs@gnu.org; Sun, 30 Dec 2012 23:03:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TpWcY-0007px-9E for bug-gnu-emacs@gnu.org; Sun, 30 Dec 2012 23:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Dec 2012 04:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13278 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13278-done@debbugs.gnu.org id=D13278.135692667430086 (code D ref 13278); Mon, 31 Dec 2012 04:05:02 +0000 Original-Received: (at 13278-done) by debbugs.gnu.org; 31 Dec 2012 04:04:34 +0000 Original-Received: from localhost ([127.0.0.1]:37507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TpWc4-0007pB-Rw for submit@debbugs.gnu.org; Sun, 30 Dec 2012 23:04:33 -0500 Original-Received: from mail-pa0-f46.google.com ([209.85.220.46]:55842) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TpWc1-0007p2-Gu for 13278-done@debbugs.gnu.org; Sun, 30 Dec 2012 23:04:31 -0500 Original-Received: by mail-pa0-f46.google.com with SMTP id bh2so6921072pad.19 for <13278-done@debbugs.gnu.org>; Sun, 30 Dec 2012 20:03:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=yx1rFcfDJOi40NINGWSmy2IbN79MR4JuE/ZBgefqE8Q=; b=UiT7maL1vxnGukvDKFNENSzjE9quZqwfrILAhRX+Bffl05BxwT8WsdXacXpOAwM3/m 5gMiAYnpfqJSMfuZwQ68nfCPjiant4CPdYkoNFKC6CTNZ8S8PjYCuK4rn0t6N/Yg8Hp6 0vxplUSU2SmIbzezUZQNMkZnF/iMrO8RrZ1atMC7ocFVBRyQm08lXLCAJXbc2i2l7rPm 81k7Nscu9BoefoswsTZrmvrfwLT7hiZyt1Sud5k/pJ3SEFg1H+RttrlhjY/tUQ6VhWih YcH5myRtnL+7lwuNU2BQGqZ59YDx4qDn5h0qKCQTTok4yuRqVFJETiKC3ELujQtv2D+U P2tQ== X-Received: by 10.68.135.99 with SMTP id pr3mr125460579pbb.151.1356926601358; Sun, 30 Dec 2012 20:03:21 -0800 (PST) Original-Received: from ulysses ([155.69.17.130]) by mx.google.com with ESMTPS id ir4sm24120387pbc.41.2012.12.30.20.03.17 (version=SSLv3 cipher=OTHER); Sun, 30 Dec 2012 20:03:19 -0800 (PST) In-Reply-To: (Katsumi Yamaoka's message of "Mon, 31 Dec 2012 09:16:31 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.91 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:69221 Archived-At: Katsumi Yamaoka writes: >> May I ask why you are trying to use `copy-face' instead of `defface'? > > I've been using it conveniently since the face feature was introduced > in Emacs. For example, it's handy when I want a face of which only > the color differs from the built-in one: > > (copy-face 'bold 'orange-bold) > (set-face-foreground 'orange-bold "Orange") > > Of course doing it by defface is not so troublesome, so I can live > without copy-face. Here's the basic issue: `copy-face' acts on internal faces (and always has, IIRC). Internal faces are vectors of face attributes, which are stored by Emacs in `face-new-frame-defaults' and in per-frame alists. The key point is that the face spec, which is specified by `defface', is separate from this. Since `defface' is used for practically all Emacs faces, the internal faces stored in `face-new-frame-defaults' are usually empty. The purpose of `face-new-frame-defaults' is to keep track of the "overriding attributes", for when the user calls `set-face-attribute', `set-face-foreground', etc. What `copy-face' does is to create a new entry for the face copy in `face-new-frame-defaults'; it doesn't touch the face spec (customization data). When you create a new frame, Emacs combines `face-new-frame-defaults' with the face spec from the face's customization data. So a face created with `copy-face', lacking that customization data, would have a blank appearance. Note also that `face-new-frame-defaults' overrides the customization data, so this mechanism inherently doesn't play well with Custom themes. That's one reason the direct setting of internal faces is downplayed/deprecated these days: it can lead to surprising effects for people who don't know what they're doing. Of course, we could make `copy-face' copy the customization data as well, if that is more useful. But this would be a backward incompatible change, and I would have to think about whether it would screw anything up.