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: [sdl.web@gmail.com: Re: scroll-bar face gets changed in a new frame] Date: Sat, 03 Feb 2007 19:35:15 -0500 Message-ID: <878xfeoj3w.fsf@stupidchicken.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1170549352 1457 80.91.229.12 (4 Feb 2007 00:35:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 4 Feb 2007 00:35:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 04 01:35:43 2007 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 1HDVM6-00085U-5p for ged-emacs-devel@m.gmane.org; Sun, 04 Feb 2007 01:35:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HDVM6-0003e7-U8 for ged-emacs-devel@m.gmane.org; Sat, 03 Feb 2007 19:35:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HDVLu-0003aK-Ca for emacs-devel@gnu.org; Sat, 03 Feb 2007 19:35:30 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HDVLt-0003a0-0s for emacs-devel@gnu.org; Sat, 03 Feb 2007 19:35:29 -0500 Original-Received: from south-station-annex.mit.edu ([18.72.1.2]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1HDVLs-0001dN-FY; Sat, 03 Feb 2007 19:35:28 -0500 Original-Received: from central-city-carrier-station.mit.edu (CENTRAL-CITY-CARRIER-STATION.MIT.EDU [18.7.7.72]) by south-station-annex.mit.edu (8.13.6/8.9.2) with ESMTP id l140ZRKR009577; Sat, 3 Feb 2007 19:35:27 -0500 (EST) Original-Received: from outgoing-legacy.mit.edu (OUTGOING-LEGACY.MIT.EDU [18.7.22.104]) by central-city-carrier-station.mit.edu (8.13.6/8.9.2) with ESMTP id l140ZFpJ006854; Sat, 3 Feb 2007 19:35:18 -0500 (EST) Original-Received: from localhost (MAIN-TWELVE-TWO-TWENTY-SEVEN.MIT.EDU [18.19.5.227]) ) by outgoing-legacy.mit.edu (8.13.6/8.12.4) with ESMTP id l140ZEe1017423; Sat, 3 Feb 2007 19:35:15 -0500 (EST) Original-Received: from cyd by localhost with local (Exim 3.36 #1 (Debian)) id 1HDVLf-00021s-00; Sat, 03 Feb 2007 19:35:15 -0500 In-Reply-To: (Richard Stallman's message of "Sat\, 03 Feb 2007 06\:19\:57 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux) X-Scanned-By: MIMEDefang 2.42 X-Spam-Score: 2 X-detected-kernel: Solaris 9.1 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:65838 Archived-At: Richard Stallman writes: > Would someone please investigate this and DTRT? The problem is in face-set-after-frame-default. The function merges in the X resources, then initializes attributes from frame parameters. However, if there is a scroll-bar X resource present, the call to make-face-x-resource-internal will chang the scroll-bar-* frame parameters in the process of changing the scroll-bar face. Therefore, any previously-applied frame parameters are lost. I think one fix is for face-set-after-frame-default to first construct a list of frame parameters to be applied (based on the new frame's frame-parameters and/or the face's value for new frames), then wait until after the call to make-face-x-resource-internal before applying these changes. See the attached patch. By the way, the symbol inhibit-default-face-x-resources seems to be a no-op; it is called as (when (not (equal face 'default)) ... (when (and (memq window-system '(x w32 mac)) (or (not (boundp 'inhibit-default-face-x-resources)) (not (eq face 'default)))) (make-face-x-resource-internal face frame))) However, since face is never `default' inside the `when' form, the enclosing `or' statement is always t, regardless of whether or not inhibit-default-face-x-resources is bound. I think this symbol was introduced to solve a similar problem, and it can be removed if the proposed fix is applied. *** emacs/lisp/faces.el.~1.362.~ 2007-02-02 11:55:30.000000000 -0500 --- emacs/lisp/faces.el 2007-02-03 19:28:18.000000000 -0500 *************** *** 1754,1788 **** (face-attribute 'default :weight t)) (set-face-attribute 'default frame :width (face-attribute 'default :width t)))) ! (dolist (face (face-list)) ! ;; Don't let frame creation fail because of an invalid face spec. ! (condition-case () ! (when (not (equal face 'default)) ! (face-spec-set face (face-user-default-spec face) frame) ! (internal-merge-in-global-face face frame) ! (when (and (memq window-system '(x w32 mac)) ! (or (not (boundp 'inhibit-default-face-x-resources)) ! (not (eq face 'default)))) ! (make-face-x-resource-internal face frame))) ! (error nil))) ! ;; Initialize attributes from frame parameters. (let ((params '((foreground-color default :foreground) (background-color default :background) (border-color border :background) (cursor-color cursor :background) (scroll-bar-foreground scroll-bar :foreground) (scroll-bar-background scroll-bar :background) ! (mouse-color mouse :background)))) (dolist (param params) ! (let ((frame-param (frame-parameter frame (nth 0 param))) ! (face (nth 1 param)) ! (attr (nth 2 param))) ! (when (and frame-param ! ;; Don't override face attributes explicitly ! ;; specified for new frames. ! (eq (face-attribute face attr t) 'unspecified)) ! (set-face-attribute face frame attr frame-param)))))) ! (defun tty-handle-reverse-video (frame parameters) "Handle the reverse-video frame parameter for terminal frames." --- 1754,1790 ---- (face-attribute 'default :weight t)) (set-face-attribute 'default frame :width (face-attribute 'default :width t)))) ! ;; Find attributes that should be initialized from frame parameters. (let ((params '((foreground-color default :foreground) (background-color default :background) (border-color border :background) (cursor-color cursor :background) (scroll-bar-foreground scroll-bar :foreground) (scroll-bar-background scroll-bar :background) ! (mouse-color mouse :background))) ! apply-params) (dolist (param params) ! (let* ((value (frame-parameter frame (nth 0 param))) ! (face (nth 1 param)) ! (attr (nth 2 param)) ! (default (face-attribute face attr t))) ! ;; Don't set the attributes yet, since the call to ! ;; make-face-x-resource-internal may change frame parameters. ! (if (eq default 'unspecified) ! (if value ! (push (list face frame attr value) apply-params)) ! (push (list face frame attr default) apply-params)))) ! (dolist (face (delq 'default (face-list))) ! ;; Don't let frame creation fail because of an invalid face spec. ! (condition-case () ! (progn ! (face-spec-set face (face-user-default-spec face) frame) ! (internal-merge-in-global-face face frame) ! (when (memq window-system '(x w32 mac)) ! (make-face-x-resource-internal face frame))) ! (error nil))) ! (dolist (param apply-params) ! (apply 'set-face-attribute param)))) (defun tty-handle-reverse-video (frame parameters) "Handle the reverse-video frame parameter for terminal frames."