unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#911: 23.0.60; custom-set-faces causes "New Frame" to fail
@ 2008-09-28 21:13 Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2008-09-28 21:13 UTC (permalink / raw)
  To: martin rudalics; +Cc: 911, Ian Miller

> > 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
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;






^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <87y71hthoc.fsf@cyd.mit.edu>]

end of thread, other threads:[~2008-09-28 21:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-28 21:13 bug#911: 23.0.60; custom-set-faces causes "New Frame" to fail Chong Yidong
     [not found] <87y71hthoc.fsf@cyd.mit.edu>
2008-09-25  9:11 ` martin rudalics
2008-09-25 14:31   ` Chong Yidong
2008-09-25 15:17     ` martin rudalics

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).