unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 911@emacsbugs.donarmstrong.com, Ian Miller <ian@soroban.fastmail.fm>
Subject: bug#911: 23.0.60; custom-set-faces causes "New Frame" to fail
Date: Sun, 28 Sep 2008 17:13:02 -0400	[thread overview]
Message-ID: <87ljxc6kkh.fsf@cyd.mit.edu> (raw)

> > 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)))))))
+ )
  
  \f
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;






             reply	other threads:[~2008-09-28 21:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-28 21:13 Chong Yidong [this message]
     [not found] <87y71hthoc.fsf@cyd.mit.edu>
2008-09-25  9:11 ` bug#911: 23.0.60; custom-set-faces causes "New Frame" to fail martin rudalics
2008-09-25 14:31   ` Chong Yidong
2008-09-25 15:17     ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ljxc6kkh.fsf@cyd.mit.edu \
    --to=cyd@stupidchicken.com \
    --cc=911@emacsbugs.donarmstrong.com \
    --cc=ian@soroban.fastmail.fm \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).