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#911: 23.0.60; custom-set-faces causes "New Frame" to fail Date: Sun, 28 Sep 2008 17:13:02 -0400 Message-ID: <87ljxc6kkh.fsf@cyd.mit.edu> Reply-To: Chong Yidong , 911@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1222637430 26504 80.91.229.12 (28 Sep 2008 21:30:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Sep 2008 21:30:30 +0000 (UTC) Cc: 911@emacsbugs.donarmstrong.com, Ian Miller To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 28 23:31:28 2008 connect(): Connection refused Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kk3rS-0000Vt-Rh for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Sep 2008 23:31:27 +0200 Original-Received: from localhost ([127.0.0.1]:46927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kk3qO-0004Ws-Tn for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Sep 2008 17:30:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kk3q9-0004EG-7h for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2008 17:30:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kk3q6-0004AB-EY for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2008 17:30:04 -0400 Original-Received: from [199.232.76.173] (port=33330 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kk3q6-0004A4-8z for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2008 17:30:02 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:47781) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kk3q5-0001Pn-3n for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2008 17:30:02 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8SLTtJ1015331; Sun, 28 Sep 2008 14:29:55 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m8SLK4bY013092; Sun, 28 Sep 2008 14:20:04 -0700 X-Loop: don@donarmstrong.com Resent-From: Chong Yidong Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sun, 28 Sep 2008 21:20:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 911 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: unreproducible Original-Received: via spool by 911-submit@emacsbugs.donarmstrong.com id=B911.122263633611736 (code B ref 911); Sun, 28 Sep 2008 21:20:04 +0000 Original-Received: (at 911) by emacsbugs.donarmstrong.com; 28 Sep 2008 21:12:16 +0000 Original-Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8SLCDjt011730 for <911@emacsbugs.donarmstrong.com>; Sun, 28 Sep 2008 14:12:14 -0700 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 01DD257E33A; Sun, 28 Sep 2008 17:13:02 -0400 (EDT) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Sun, 28 Sep 2008 17:30:04 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:20863 Archived-At: > > Why not in frame-set-background-mode itself? Then, when it's set, > > subsequent calls to that function could be no-ops. > > We have to reset it eventually. And we have to cater for the situation > that a user might want to open two frames in one and the same command. > So I suppose the only reliable place is the command loop. And we must > make sure that the background determined by the user is considered. I'm not sure what you mean. To be precise, here's a patch implementing the approach I'm suggesting (indentated for readability). Would it work? (I can't reproduce the original bug myself, so maybe Ian can test it.) *** trunk/lisp/faces.el.~1.425.~ 2008-09-24 12:51:07.000000000 -0400 --- trunk/lisp/faces.el 2008-09-28 17:10:55.000000000 -0400 *************** *** 1839,1848 **** --- 1839,1851 ---- (declare-function x-get-resource "frame.c" (attribute class &optional component subclass)) + (defvar inhibit-frame-set-background-mode nil) + (defun frame-set-background-mode (frame) "Set up display-dependent faces on FRAME. Display-dependent faces are those which have different definitions according to the `background-mode' and `display-type' frame parameters." + (unless inhibit-frame-set-background-mode (let* ((bg-resource (and (window-system frame) (x-get-resource "backgroundMode" "BackgroundMode"))) *************** *** 1893,1899 **** (frame-parameter frame 'display-type))) (unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type)) ! (let ((locally-modified-faces nil)) ;; Before modifying the frame parameters, we collect a list of ;; faces that don't match what their face-spec says they should ;; look like; we then avoid changing these faces below. --- 1896,1905 ---- (frame-parameter frame 'display-type))) (unless (and (eq bg-mode old-bg-mode) (eq display-type old-display-type)) ! (let ((locally-modified-faces nil) ! ;; Prevent face-spec-recalc from calling this function ! ;; again, resulting in a loop. ! (inhibit-frame-set-background-mode t)) ;; Before modifying the frame parameters, we collect a list of ;; faces that don't match what their face-spec says they should ;; look like; we then avoid changing these faces below. *************** *** 1915,1920 **** --- 1921,1927 ---- (dolist (face (face-list)) (unless (memq face locally-modified-faces) (face-spec-recalc face frame))))))) + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;