GNU bug report logs - 
#65025
Possible race in make-frame
Previous Next
To reply to this bug, email your comments to 65025 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to 
bug-gnu-emacs <at> gnu.org:
bug#65025; Package 
emacs.
 (Wed, 02 Aug 2023 17:38:02 GMT) 
Full text and 
rfc822 format available.
 
Acknowledgement sent
to 
Anders Blomdell <anders.blomdell <at> control.lth.se>:
New bug report received and forwarded.  Copy sent to 
bug-gnu-emacs <at> gnu.org.
 (Wed, 02 Aug 2023 17:38:02 GMT) 
Full text and 
rfc822 format available.
 
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
When running
  /usr/bin/emacsclient --eval '(make-frame)'
it sometimes (often) opens up a small window (10x21) instead of the expected 40x80 window.
Setting a hook for after-make-frame-functions like this:
(progn
  (setq after-make-frame-functions nil)
  (add-hook
   'after-make-frame-functions
   (lambda (frame)
     (let ((width 80)
           (height 40)
           (start-width (frame-width frame))
           (start-height (frame-height frame))
           (visible (frame-visible-p frame)))
       (print (format "Start %dx%d %S"
                      start-height start-width visible))
       (if (not visible)
           (progn
             (while
                 (not (frame-visible-p frame))
               (progn
                 (sleep-for 0.001)
                 (print (format "X %dx%d"
                                (frame-height frame)
                                (frame-width frame)))
                 ))
             (sleep-for 0.001)
             (print (format "Resetting %dx%d -> %dx%d"
                            (frame-height frame) (frame-width frame)
                            height width))
             (set-frame-width frame width)
             (set-frame-height frame height)
             (sleep-for 0.1)
             (print (format "Resetting %dx%d -> %dx%d"
                            (frame-height frame) (frame-width frame)
                            height width))
             (set-frame-width frame width)
             (set-frame-height frame height)
             )
             )
         )
       (print (format "Done %dx%d"
                      (frame-height frame)
                      (frame-width frame)))
       )
   )
  )
usually has two different outcomes:
  "Start 10x38 t"
  "Done 10x38"
or
  "Start 40x80 nil"
  "X 40x80"
  "X 40x80"
  "X 40x80"
  "X 10x21"
  "Resetting 10x21 -> 40x80"
  "Resetting 40x80 -> 40x80"
  "Done 40x80"
-- 
Anders Blomdell                  Email: anders.blomdell <at> control.lth.se
Department of Automatic Control
Lund University                  Phone:    +46 46 222 8793
P.O. Box 118
SE-221 00 Lund, Sweden
Information forwarded
to 
bug-gnu-emacs <at> gnu.org:
bug#65025; Package 
emacs.
 (Wed, 02 Aug 2023 17:52:02 GMT) 
Full text and 
rfc822 format available.
 
Message #8 received at 65025 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 2 Aug 2023 16:02:06 +0200
> From:  Anders Blomdell via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> When running
> 
>    /usr/bin/emacsclient --eval '(make-frame)'
> 
> it sometimes (often) opens up a small window (10x21) instead of the expected 40x80 window.
> 
> Setting a hook for after-make-frame-functions like this:
> 
> (progn
>    (setq after-make-frame-functions nil)
>    (add-hook
>     'after-make-frame-functions
>     (lambda (frame)
>       (let ((width 80)
>             (height 40)
>             (start-width (frame-width frame))
>             (start-height (frame-height frame))
>             (visible (frame-visible-p frame)))
>         (print (format "Start %dx%d %S"
>                        start-height start-width visible))
>         (if (not visible)
>             (progn
>               (while
>                   (not (frame-visible-p frame))
>                 (progn
>                   (sleep-for 0.001)
>                   (print (format "X %dx%d"
>                                  (frame-height frame)
>                                  (frame-width frame)))
>                   ))
>               (sleep-for 0.001)
>               (print (format "Resetting %dx%d -> %dx%d"
>                              (frame-height frame) (frame-width frame)
>                              height width))
>               (set-frame-width frame width)
>               (set-frame-height frame height)
>               (sleep-for 0.1)
>               (print (format "Resetting %dx%d -> %dx%d"
>                              (frame-height frame) (frame-width frame)
>                              height width))
>               (set-frame-width frame width)
>               (set-frame-height frame height)
>               )
>               )
>           )
>         (print (format "Done %dx%d"
>                        (frame-height frame)
>                        (frame-width frame)))
>         )
>     )
>    )
> 
> 
> 
> usually has two different outcomes:
> 
>    "Start 10x38 t"
>    "Done 10x38"
> 
> or
> 
>    "Start 40x80 nil"
>    "X 40x80"
>    "X 40x80"
>    "X 40x80"
>    "X 10x21"
>    "Resetting 10x21 -> 40x80"
>    "Resetting 40x80 -> 40x80"
>    "Done 40x80"
Isn't this because we wait fro X to resize the frame after we ask for
it?
This bug report was last modified 2 years and 94 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.