(null frame-initial-frame))
;; This case happens when we don't have a window system, and
;; also for MS-DOS frames.
- (let ((parms (frame-parameters frame-initial-frame)))
+ (let ((parms (frame-parameters)))
;; Don't change the frame names.
(setq parms (delq (assq 'name parms) parms))
;; Can't modify the minibuffer parameter, so don't try.
(setq parms (delq (assq 'minibuffer parms) parms))
- (modify-frame-parameters nil
- (if (null initial-window-system)
- (append initial-frame-alist
- window-system-frame-alist
- default-frame-alist
- parms
- nil)
- ;; initial-frame-alist and
- ;; default-frame-alist were already
- ;; applied in pc-win.el.
- parms))
+ (modify-frame-parameters
+ nil
+ (if initial-window-system
+ parms
+ ;; initial-frame-alist and default-frame-alist were already
+ ;; applied in pc-win.el.
+ (append initial-frame-alist window-system-frame-alist
+ default-frame-alist parms nil)))
(if (null initial-window-system) ;; MS-DOS does this differently in pc-win.el
(let ((newparms (frame-parameters))
(frame (selected-frame)))
;; it is undesirable to specify the parm again
;; once the user has seen the frame and been able to alter it
;; manually.
- (while tail
- (let (newval oldval)
- (setq oldval (assq (car (car tail))
- frame-initial-frame-alist))
- (setq newval (cdr (assq (car (car tail)) allparms)))
+ (let (newval oldval)
+ (dolist (entry tail)
+ (setq oldval (assq (car entry) frame-initial-frame-alist))
+ (setq newval (cdr (assq (car entry) allparms)))
(or (and oldval (eq (cdr oldval) newval))
(setq newparms
- (cons (cons (car (car tail)) newval) newparms))))
- (setq tail (cdr tail)))
+ (cons (cons (car entry) newval) newparms)))))
(setq newparms (nreverse newparms))
- (modify-frame-parameters frame-initial-frame
- newparms)
- ;; If we changed the background color,
- ;; we need to update the background-mode parameter
- ;; and maybe some faces too.
- (when (assq 'background-color newparms)
- (unless (assq 'background-mode newparms)
- (frame-set-background-mode frame-initial-frame))
- (face-set-after-frame-default frame-initial-frame)))))
+
+ (let ((new-bg (assq 'background-color newparms)))
+ ;; If the `background-color' parameter is changed, apply
+ ;; it first, then make sure that the `background-mode'
+ ;; parameter and other faces are updated, before applying
+ ;; the other parameters.
+ (when new-bg
+ (modify-frame-parameters frame-initial-frame
+ (list new-bg))
+ (unless (assq 'background-mode newparms)
+ (frame-set-background-mode frame-initial-frame))
+ (face-set-after-frame-default frame-initial-frame)
+ (setq newparms (delq new-bg newparms)))
+ (modify-frame-parameters frame-initial-frame newparms)))))
;; Restore the original buffer.
(set-buffer old-buffer)