From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#13956: 24.3; An initial frame already exists before reading .emacs on daemon mode Date: Wed, 14 Jun 2017 20:02:11 -0400 Message-ID: <87zidarud8.fsf@users.sourceforge.net> References: <51419812.9080009@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1497484897 6031 195.159.176.226 (15 Jun 2017 00:01:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 15 Jun 2017 00:01:37 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 13956@debbugs.gnu.org To: Arthur Tu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 15 02:01:33 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLIE8-0001OQ-RZ for geb-bug-gnu-emacs@m.gmane.org; Thu, 15 Jun 2017 02:01:32 +0200 Original-Received: from localhost ([::1]:51298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLIEE-0004Eg-5e for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Jun 2017 20:01:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLIDi-0003xw-QG for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2017 20:01:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLIDe-0003ef-SL for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2017 20:01:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45459) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLIDe-0003eY-OL for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2017 20:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dLIDe-0001lD-I6 for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2017 20:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Jun 2017 00:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13956 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13956-submit@debbugs.gnu.org id=B13956.14974848425610 (code B ref 13956); Thu, 15 Jun 2017 00:01:02 +0000 Original-Received: (at 13956) by debbugs.gnu.org; 15 Jun 2017 00:00:42 +0000 Original-Received: from localhost ([127.0.0.1]:48136 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLIDJ-0001Rv-Tx for submit@debbugs.gnu.org; Wed, 14 Jun 2017 20:00:42 -0400 Original-Received: from mail-io0-f174.google.com ([209.85.223.174]:35121) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLIDI-0001Lo-Mi; Wed, 14 Jun 2017 20:00:41 -0400 Original-Received: by mail-io0-f174.google.com with SMTP id k93so1953033ioi.2; Wed, 14 Jun 2017 17:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=p6UxVkxLOoyvmbggHPs+uDVG3soPId8TcijyhGs50+E=; b=LLbxnKHbupJ65nTY2oIxL30K3LlNrK3K7OGYUlhACbY+ZYc4ljj+UgBawR660kG6gB 1zv9qx5OuAMhiMcuUZ7nRWW7G1uPGuZxJNNl1zhTe4TFEpTZjP9t6BDnaYSQfN8q1ZOS RzAuioZUxYr+A4/0GxuHnpOiGC+v3H1z+1DS9LT1xbn+cuCnq95nZenxgbPLo5nvsxH3 qy8Dix7/t2Xs9RBcpN03vPQFly69WC9PHPtnfIc+dd6mW3mVs+3ZXPWUHPB1JGQZb7X3 LBy5CLwdkIXURQIRo43WpujmnbBF84/hKja9JVCnHXZZcYjpgHiWN2EsQ2tLx0lxaI91 ATWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=p6UxVkxLOoyvmbggHPs+uDVG3soPId8TcijyhGs50+E=; b=f6LDDdYL8ICmqeZomydw40kp7Mo7OPImvdv1HmMLAukAh0SJm7sW2PATh2WvsnOt8E 3QQFDu7r6bx7xZNsRlmWghpRTYTtHsIk8mpwMixaVBLkf5iIsiao32v0ev416V9YDzrT 4I0Dl5BsE+KLzt9qh2tjYVuJ4c5t6Ycvzdvs8x/WVGms2EMBZEaoyEJVczeWi1A/d/W5 Dm7+NDMUJTqGLlD4HA4751bV91TxPXoapUWOgFMHxcRBw33Dnt1wByUxfr89ZnOZFkHB q4TtSJ/NJfV57FeW18EUEYwNeR9gVD2nNLU95MmbGVZzBB8XMPw6IGCin6BpHxZvOUDz DkBg== X-Gm-Message-State: AKS2vOw5S5bLRMUNdCoThnN00gik8XRLxITivBsGjCYed714G17aEDGS lk/6I6tfFPnBc7ln X-Received: by 10.107.139.5 with SMTP id n5mr3018479iod.166.1497484834625; Wed, 14 Jun 2017 17:00:34 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id a138sm722275ioa.15.2017.06.14.17.00.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Jun 2017 17:00:33 -0700 (PDT) In-Reply-To: <51419812.9080009@gmail.com> (Arthur Tu's message of "Thu, 14 Mar 2013 17:27:46 +0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133595 Archived-At: tags 13956 notabug wontfix close 13956 quit Arthur Tu writes: > 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 daemon mode, the initial frame stays hidden, so there's no meaningful size. You should do something like (if (and (not (daemonp)) initial-window-system) ...)