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: Faces applies to new frames Date: Thu, 26 Jun 2008 18:50:56 -0400 Message-ID: <87k5gbx12n.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 1214520966 19155 80.91.229.12 (26 Jun 2008 22:56:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Jun 2008 22:56:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 27 00:56:51 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 1KC0OR-0000IC-NC for ged-emacs-devel@m.gmane.org; Fri, 27 Jun 2008 00:56:44 +0200 Original-Received: from localhost ([127.0.0.1]:43893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KC0Nb-0001Ls-W0 for ged-emacs-devel@m.gmane.org; Thu, 26 Jun 2008 18:55:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KC0NX-0001LR-1j for emacs-devel@gnu.org; Thu, 26 Jun 2008 18:55:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KC0NV-0001LF-Lx for emacs-devel@gnu.org; Thu, 26 Jun 2008 18:55:45 -0400 Original-Received: from [199.232.76.173] (port=52685 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KC0NV-0001LC-GZ for emacs-devel@gnu.org; Thu, 26 Jun 2008 18:55:45 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]:48842) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KC0NV-0007wO-5H for emacs-devel@gnu.org; Thu, 26 Jun 2008 18:55:45 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 14C704E474; Thu, 26 Jun 2008 18:50:56 -0400 (EDT) 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:99981 Archived-At: I took a look at the problem that several people have reported regarding default faces not being applied to new frames (e.g. 47 and 120 in the bug tracker). AFAICT, the problem is that the default face is controlled by the `font' frame parameter, but this is not saved to default-frame-alist by internal-set-lisp-face-attribute. In comparison, the foreground-color and background-color frame attributes are saved properly (see xfaces.c:3415 and 3470). It doesn't seem practical to fix internal-set-lisp-face-attribute, but I think we can patch it up in faces.el. Could someone check whether this reasoning makes sense, and whether the attached patch to set-face-attribute makes things work properly? (BTW, this doesn't affect default faces set under customize under some circumstances, because that changes the defface spec directly instead of using set-face-attribute.) *** trunk/lisp/faces.el.~1.415.~ 2008-06-25 18:27:01.000000000 -0400 --- trunk/lisp/faces.el 2008-06-26 18:41:07.000000000 -0400 *************** *** 700,706 **** VALUE is the name of a face from which to inherit attributes, or a list of face names. Attributes from inherited faces are merged into the face like an underlying face would be, with higher priority than underlying faces." ! (let ((where (if (null frame) 0 frame))) (setq args (purecopy args)) ;; If we set the new-frame defaults, this face is modified outside Custom. (if (memq where '(0 t)) --- 700,716 ---- VALUE is the name of a face from which to inherit attributes, or a list of face names. Attributes from inherited faces are merged into the face like an underlying face would be, with higher priority than underlying faces." ! (let* ((where (if (null frame) 0 frame)) ! (save-modified-font ! (and (eq where 0) ! (eq face 'default) ! (or (plist-member args :family) ! (plist-member args :height) ! (plist-member args :weight) ! (plist-member args :slant) ! (plist-member args :width) ! (plist-member args :bold) ! (plist-member args :italic))))) (setq args (purecopy args)) ;; If we set the new-frame defaults, this face is modified outside Custom. (if (memq where '(0 t)) *************** *** 723,729 **** (internal-set-lisp-face-attribute face (car args) (purecopy (cadr args)) where))) ! (setq args (cdr (cdr args)))))) (defun make-face-bold (face &optional frame noerror) --- 733,744 ---- (internal-set-lisp-face-attribute face (car args) (purecopy (cadr args)) where))) ! (setq args (cdr (cdr args)))) ! ! (when save-modified-font ! (setq default-frame-alist ! (cons (cons 'font (frame-parameter (selected-frame) 'font)) ! (assq-delete-all 'font default-frame-alist)))))) (defun make-face-bold (face &optional frame noerror)