Subject: bug#13956: 24.3; An initial frame already exists before reading .emacs on daemon mode

From: Arthur Tu <[email-masked]>
Date: Thu, 14 Mar 2013 17:27:46 +0800

I want to call emacsclient to edit my file after start emacs
server once manually.

I have following code in my .emacs:

(defun set-frame ()
   (interactive)
   ;;(setq initial-frame-alist '((width . 80) (height . 20) 
(menu-bar-lines . 1)))
   (progn
     ;; use 120 char wide window for largeish displays
     ;; and smaller 80 column windows for smaller displays
     ;; pick whatever numbers make sense for you
     (if (> (x-display-pixel-width) 1280)
     (add-to-list 'default-frame-alist (cons 'width 120))
       (add-to-list 'default-frame-alist (cons 'width 120)))
     ;; for the height, subtract a couple hundred pixels
     ;; from the screen height (for panels, menubars and
     ;; whatnot), then divide by the height of a char to
     ;; get the height we want
     (add-to-list 'default-frame-alist
          (cons 'height (/ (- (x-display-pixel-height) 250)
                   (frame-char-height))))
     ))

(add-hook 'after-init-hook
       ;; ask user whether to restore desktop at start-up
       (lambda ()
         (if initial-window-system
         (set-frame)
           (add-hook 'server-visit-hook 'set-frame))))

However, the first emacsclient frame can't be set to the size i want.

I don't know if this bug is in cygwin branch only or global.

Help please.

In GNU Emacs 24.3.1 (i686-pc-cygwin)
  of 2013-03-11 on fiona
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
  `configure
  '--srcdir=/home/kbrown/src/cygemacs/emacs-24.3-1/src/emacs-24.3'
  '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin'
  '--sbindir=/usr/sbin' '--libexecdir=/usr/lib' '--datadir=/usr/share'
  '--localstatedir=/var' '--sysconfdir=/etc' '--datarootdir=/usr/share'
  '--docdir=/usr/share/doc/emacs' '-C' '--with-w32' 'CC=gcc'
  'CFLAGS=-ggdb -O2 -pipe
  -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.3-1/build=/usr/src/debug/emacs-24.3-1
  -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.3-1/src/emacs-24.3=/usr/src/debug/emacs-24.3-1'
  'LDFLAGS=-L/usr/lib/ncursesw' 'LIBS='
  'CPPFLAGS=-I/usr/include/ncursesw''

Important settings:
   value of $LANG: en_US.UTF-8
   locale-coding-system: utf-8-unix
   default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
   yas-global-mode: t
   yas-minor-mode: t
   google-this-mode: t
   global-auto-complete-mode: t
   auto-complete-mode: t
   cygwin-terminal-clipboard-mode: t
   show-paren-mode: t
   global-linum-mode: t
   linum-mode: t
   tooltip-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-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

Recent input:
<lwindow> <lwindow> <lwindow> <lwindow> <lwindow> <lwindow>
<lwindow> <lwindow> <lwindow> <lwindow> <lwindow> <lwindow>
<lwindow> <lwindow> <lwindow> <lwindow> <lwindow> <lwindow>
<lwindow> <lwindow> <lwindow> <lwindow> <lwindow> <lwindow>
<lwindow> <lwindow> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> C-x C-f <backspace>
<backspace> h o <backspace> <backspace> ~ <backspace>
<backspace> <backspace> ~ <backspace> h o <return>
<return> . e <return> C-v C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-p C-p C-n C-l C-l C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n <help-echo>
<help-echo> M-x r e p o r <tab> <return> C-g M-x t
o o l <tab> = b a <tab> <backspace> <backspace> <backspace>
- b a r <tab> <return> M-x r e p o r <tab> <return

Recent messages:
[yas] Loading for `c-mode', just-in-time: (yas--load-directory-1 
/home/Arthur/.emacs.d/elpa/yasnippet-20130218.2229/snippets/c-mode 
(quote c-mode) (quote (cc-mode)))!
[yas] Loading compiled snippets from 
/home/Arthur/.emacs.d/elpa/yasnippet-20130218.2229/snippets/c-mode
[yas] Loading for `cc-mode', just-in-time: (yas--load-directory-1 
/home/Arthur/.emacs.d/elpa/yasnippet-20130218.2229/snippets/cc-mode 
(quote cc-mode) (quote (text-mode)))!
[yas] Loading compiled snippets from 
/home/Arthur/.emacs.d/elpa/yasnippet-20130218.2229/snippets/cc-mode
When done with a buffer, type C-x #
When done with this frame, type C-x 5 0 [3 times]
byte-code: Beginning of buffer [7 times]
Quit
Making completion list...
Tool-Bar mode disabled

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr cus-start cus-load emacsbug message
format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils flymake-cursor byte-opt
warnings bytecomp byte-compile cconv flymake compile comint ansi-color
ring cc-langs cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs server yasnippet help-mode easymenu
google-this auto-complete-config auto-complete cl-macs gv popup cl
auto-complete-autoloads flymake-css-autoloads flymake-cursor-autoloads
flymake-php-autoloads flymake-python-pyflakes-autoloads
flymake-shell-autoloads flymake-easy-autoloads google-this-autoloads
google-translate-autoloads guess-offset-autoloads haskell-mode-autoloads
mmm-mode-autoloads php-mode-autoloads popup-autoloads
w32-browser-autoloads yasnippet-autoloads package
cygwin-terminal-clipboard easy-mmode flex-mode derived tsdh-dark-theme
edmacro kmacro avoid time-date paren uniquify linum ido advice help-fns
cl-lib advice-preload tooltip ediff-hook vc-hooks lisp-float-type mwheel
w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind w32 multi-tty emacs)