From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Faces applies to new frames Date: Sun, 29 Jun 2008 11:25:26 -0400 Message-ID: <87prq0z2jd.fsf@stupidchicken.com> References: <87k5gbx12n.fsf@stupidchicken.com> <87iqvty2e7.fsf@stupidchicken.com> <871w2hcek1.fsf@stupidchicken.com> <87wsk8kgm5.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1214753142 13162 80.91.229.12 (29 Jun 2008 15:25:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 29 Jun 2008 15:25:42 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 29 17:26:26 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KCynK-0005Nn-Ad for ged-emacs-devel@m.gmane.org; Sun, 29 Jun 2008 17:26:26 +0200 Original-Received: from localhost ([127.0.0.1]:57035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCymU-0007pn-4M for ged-emacs-devel@m.gmane.org; Sun, 29 Jun 2008 11:25:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KCymO-0007nD-N2 for emacs-devel@gnu.org; Sun, 29 Jun 2008 11:25:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KCymN-0007lp-Kc for emacs-devel@gnu.org; Sun, 29 Jun 2008 11:25:28 -0400 Original-Received: from [199.232.76.173] (port=45499 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCymN-0007lR-D7 for emacs-devel@gnu.org; Sun, 29 Jun 2008 11:25:27 -0400 Original-Received: from c-24-63-201-57.hsd1.ma.comcast.net ([24.63.201.57]:17664 helo=furry) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KCymM-00041a-V4 for emacs-devel@gnu.org; Sun, 29 Jun 2008 11:25:27 -0400 Original-Received: by furry (Postfix, from userid 1000) id 33C61C056; Sun, 29 Jun 2008 11:25:26 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Sun, 29 Jun 2008 02:11:08 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:100136 Archived-At: Stefan Monnier writes: >> + ;; The face specs may specify a different default font. Save this >> + ;; in the `font' frame parameter. >> + (when (face-font 'default) >> + (set-frame-parameter frame 'font (face-font 'default))) > > That can't be right. What you're doing here is copying the > selected-frame's default font to `frame'. Why should we rely on the > selected frame? Typo. I meant to use the font attribute of the default face in the new frame: *** trunk/lisp/faces.el.~1.416.~ 2008-06-28 22:14:35.000000000 -0400 --- trunk/lisp/faces.el 2008-06-29 11:11:35.000000000 -0400 *************** *** 2056,2061 **** --- 2056,2065 ---- (make-face-x-resource-internal face frame)) (internal-merge-in-global-face face frame)) (error nil))) + ;; The face specs may specify a different default font. Save this + ;; in the `font' frame parameter. + (when (face-font 'default frame) + (set-frame-parameter frame 'font (face-font 'default frame))) ;; Apply the attributes specified by frame parameters. This ;; rewrites parameters changed by make-face-x-resource-internal (dolist (param apply-params) The point is that the default face in the new frame specifies a font (based on its family, slant, and weight attributes) that may differ from the `font' frame parameter. In that case, it's the former we should use. The call to face-font returns a font object consistent with the attributes of the default face. Any font-parameter supplied by the user further overrides this. Make sense? > It appears to read some of the settings for the `default' face from > face-new-frame-defaults and then applies them to the `default' face on > the current frame. This seems both useless and dubious: > face-new-frame-defaults is presumably obeyed elsewhere already, and > why should we only play with the `font' part of the `default' face? Not sure. It's possible that some of the operations in face-new-frame-defaults need some information in the default face, e.g. to figure out column widths, even if that information is later revised. > - apply defface > - apply Xresources > - apply face-new-frame-defaults > - apply frame-parameters > > The first 3 will always return the exact same result for every frame on > the same terminal (at least, if we ignore frame-specific Xresource > settings). > > So I don't see why we can't just precompute this result at > terminal-creation time and store it directly in face-new-frame-defaults > (after making this variable terminal-local). Now I see your point. The problem with this proposal is that if Lisp code changes the defface spec, we would need to update this value by recomputing X resources, face-new-frame-defaults, etc etc. Since we allow Lisp code to access defface specs as Lisp lists instead of using accessor functions, I don't see how to handle this.