Subject: 23.0.90; set-frame-width does not take effect immediately?
From: Alex Khesin <[email-masked]>
To: [email-masked]
Date: Thu, 19 Feb 2009 23:05:53 -0500 (EST)

Consider the following function

(defun test-split-window ()
  (interactive)
  (delete-other-windows)
  (set-frame-width (selected-frame) 80)
  (set-frame-width (selected-frame) 163)
  (split-window-horizontally -80))

Up to about a month ago, CVS emacs used to end up with a frame containing two 80-characters-wide windows after executing test-split-window.  I updated to the latest CVS earlier today, and I now get one of two behaviors: either the frame is made 80 wide but split in two, or the frame becomes 163 wide, but not split at all, with "Window width 0 (after splitting)" error message.  Adding short sleeps after set-frame-width fixes it:

(defun test-split-window ()
  (interactive)
  (delete-other-windows)
  (set-frame-width (selected-frame) 80)
  (sleep-for 0 500)
  (set-frame-width (selected-frame) 163)
  (sleep-for 0 500)
  (split-window-horizontally -80))

Executing the set-frame-window and split-window-horizontally by hand, one after another, also has the desirable effect.

It looks like set-frame-width does not take effect immediately anymore.

In GNU Emacs 23.0.90.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.12.9)
 of 2009-02-19 on alexk-warp.nyc.corp.google.com
Windowing system distributor `The X.Org Foundation', version 11.0.60900000
configured using `configure  '--with-x''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: C
  value of $LC_NUMERIC: C
  value of $LC_TIME: C
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Help

Minor modes in effect:
  googlemenu-mode: t
  which-function-mode: t
  desktop-save-mode: t
  recentf-mode: t
  cua-mode: t
  show-paren-mode: t
  savehist-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  view-mode: t

Recent input:
<up> <up> <up> <S-down> <S-down> <S-down> <S-down> 
<S-down> C-c <timeout> C-x b <return> <S-up> <S-up> 
<S-up> <S-up> <S-up> <S-up> <S-down> C-√ C-v <S-up> 
<S-up> <S-up> <S-up> <S-up> M-x e v a k <backspace> 
l - r e g <tab> <return> M-x a k - d o <tab> <return> 
M-x a k - s i n <tab> <return> M-x <up> <up> <return> 
<help-echo> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<down-mouse-4> <mouse-4> <double-down-mouse-4> <double-mouse-4> 
<up> <up> <down> <S-down> <S-down> <S-down> <S-down> 
<S-down> <S-down> C-c <timeout> M-x <help-echo> r e 
p o r t - e m a <tab> <return> a <return> <help-echo> 
<help-echo> <help-echo> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <down-mouse-4> <mouse-4> <double-down-mouse-4> 
<double-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <down-mouse-1> 
<mouse-1> M-x m a k e - f r <tab> <return> <switch-frame> 
C-x m n C-x m y a l e k <backspace> x k <backspace> 
@ k h e s i n . c o m <down> e s t <backspace> <backspace> 
<backspace> t e s t <down> <down> t e s t i n g <help-echo> 
C-c C-s C-x k <return> M-x a k - s i n <tab> <return> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> M-x 
a k - d o <tab> <return> M-x a k - d o <tab> <return> 
M-x a k - d <tab> <return> M-x a k - s i n <tab> <return> 
M-x a k - d o <tab> <return> M-x <up> <return> M-x 
a k s i n <tab> <backspace> <backspace> <backspace> 
<up> <up> <return> M-x <up> <up> <return> <switch-frame> 
M-x C-r b u g <return> <return>

Recent messages:
byte-code: Beginning of buffer
byte-code: End of buffer [5 times]
byte-code: Beginning of buffer [4 times]
Auto-saving...
Auto-saving *mail*: Opening output file: no such file or directory, /tmp/alexk/emacs_autosaves/home/alexk/#%*mail*#
Unsent message being composed; erase it? (y or n) 
sendmail-user-agent-compose: Message aborted
Unsent message being composed; erase it? (y or n) 
Sending...done
split-window-horizontally: Window width 0 too small (after splitting) [3 times]