all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Juanma Barranquero <lekktu@gmail.com>, 11102@debbugs.gnu.org
Subject: bug#11102: 24.0.94; C-x C-c from a client frame sometimes kills the whole Emacs process
Date: Sat, 14 Apr 2012 13:34:27 +0800	[thread overview]
Message-ID: <87sjg6uba4.fsf@gnu.org> (raw)
In-Reply-To: <87zkaeud3l.fsf@gnu.org> (Chong Yidong's message of "Sat, 14 Apr 2012 12:55:10 +0800")

Chong Yidong <cyd@gnu.org> writes:

> If on a client frame created by "emacsclient -c -n" the C-x C-c command
> kills Emacs, that is indeed a bug.  My guess would be that the `client'
> frame parameter is not getting correctly assigned to the newly-created
> frame on Windows, due to the extra juggling in the #ifdef WINDOWSNT code
> segment Juanma pointed out.

Took a quick look, and indeed the "set tty = 1 on Windows" hack does
seem to be at fault.  Here's my diagnosis:

  if (tty || !current_frame)
    {
      display = (const char *) ttyname (0);  /* Arg is ignored.  */
      current_frame = 0;
      tty = 1;
    }

  ...

  /* --no-wait implies --current-frame on ttys when there are file
     arguments or expressions given.  */
  if (nowait && tty && argc - optind > 0)
    current_frame = 1;

When tty = 1, if there are also -n and filename arguments, emacsclient
assumes that a current Emacs frame must be used.  This assumption is not
correct if the tty = 1 is because of the Window hack.  As a result, the
server calls `server-select-display', which ends up trying to create a
new frame on the display ttyname(0), contra the "Arg is ignored"
comment.  That new frame, if created, lacks the `client' frame parameter
for C-x C-c to work right.

Does the following patch DTRT?  This is an attempt at making a minimal
change, for Emacs 24.1.  For the trunk, I think it is worth trying to
untangle the logic properly, but that will needs Someone(tm) to work on
it who has access to a Windows box.


=== modified file 'lisp/server.el'
*** lisp/server.el	2012-04-04 17:13:00 +0000
--- lisp/server.el	2012-04-14 05:29:24 +0000
***************
*** 1136,1141 ****
--- 1136,1145 ----
  	    (setq frame
  		  (cond
  		   ((and use-current-frame
+ 			 ;; On Windows, we pass -tty as a hack, using
+ 			 ;; a bogus display name.
+ 			 (or (not (eq window-system 'w32))
+ 			     (equal display "CONOUT$"))
  			 (or (eq use-current-frame 'always)
  			     ;; We can't use the Emacs daemon's
  			     ;; terminal frame.






  reply	other threads:[~2012-04-14  5:34 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 18:56 bug#11102: 24.0.94; C-x C-c from a client frame sometimes kills the whole Emacs process Dani Moncayo
2012-03-30 17:01 ` Chong Yidong
2012-03-30 17:45   ` Eli Zaretskii
2012-03-30 20:29     ` Juanma Barranquero
2012-04-12 18:11     ` Juanma Barranquero
2012-04-13 14:38       ` Eli Zaretskii
2012-04-13 15:20         ` Dani Moncayo
2012-04-13 15:46           ` Eli Zaretskii
2012-04-13 23:49             ` Juanma Barranquero
2012-04-14  4:03               ` Chong Yidong
2012-04-14  7:26                 ` Eli Zaretskii
2012-04-13 16:10         ` Juanma Barranquero
2012-04-13 16:13           ` Juanma Barranquero
2012-04-13 17:55             ` Eli Zaretskii
2012-04-13 19:15               ` Juanma Barranquero
2012-04-13 21:00                 ` Eli Zaretskii
2012-04-14  4:55         ` Chong Yidong
2012-04-14  5:34           ` Chong Yidong [this message]
2012-04-14  7:25             ` Eli Zaretskii
2012-04-14  8:17               ` Chong Yidong
2012-04-14  9:28                 ` Eli Zaretskii
2012-04-14 10:33                   ` Chong Yidong
2012-04-14 11:37                     ` Eli Zaretskii
2012-04-14 13:18                       ` Chong Yidong
2012-04-14 13:34                         ` Eli Zaretskii
2012-04-15  8:53                           ` Chong Yidong
2012-04-20  8:23                             ` Dani Moncayo
2012-04-20 19:10                               ` Dani Moncayo
2012-04-14  9:36           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sjg6uba4.fsf@gnu.org \
    --to=cyd@gnu.org \
    --cc=11102@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=lekktu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.