bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14841: Frames created invisible have their visibility parameter set


From: Eli Zaretskii
Subject: bug#14841: Frames created invisible have their visibility parameter set to t
Date: Thu, 25 Jul 2013 22:35:28 +0300

> From: Juanma Barranquero <address@hidden>
> Date: Wed, 24 Jul 2013 18:50:03 +0200
> Cc: address@hidden
> 
>  ;;; .emacs
>  (let ((f (selected-frame)))
>    (make-frame)
>    (delete-frame f))
> ;;; .emacs ends here
> 
>  emacs
> 
>  =>
> 
>  Warning (initialization): An error occurred while loading
> `c:/Devel/emacs/test/.emacs':
> 
>  error: Attempt to delete the sole visible or iconified frame

Btw, this trivial modification will avoid the problem:

    (let ((f (selected-frame))
          (f1 (make-frame)))
      (make-frame-visible f1)
      (delete-frame f))

as will this:

    (let ((f (selected-frame))
          (f1 (make-frame)))
      (sit-for 0)
      (delete-frame f))

The problem here is that x-create-frame-with-faces does this:

  (setq parameters (x-handle-named-frame-geometry parameters))
  (let* ((params (copy-tree parameters))
         (visibility-spec (assq 'visibility parameters))
         (delayed-params '(foreground-color background-color font
                           border-color cursor-color mouse-color
                           visibility scroll-bar-foreground
                           scroll-bar-background))
         frame success)
    (dolist (param delayed-params)
      (setq params (assq-delete-all param params)))
    (setq frame (x-create-frame `((visibility . nil) . ,params))) <<<<<<<<<
    (unwind-protect
        (progn
          (x-setup-function-keys frame)
          (x-handle-reverse-video frame parameters)
          (frame-set-background-mode frame t)
          (face-set-after-frame-default frame parameters)
          (if (null visibility-spec)
              (make-frame-visible frame)                            <<<<<<<
            (modify-frame-parameters frame (list visibility-spec))) <<<<<<<

IOW, it first creates a frame that is invisible, and only then applies
the visibility spec.  So you must wait for the frame to come up before
you can delete the initial frame.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]