From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: dhruva Newsgroups: gmane.emacs.devel Subject: Re: emacsclient on WXP does not work (as it used to) Date: Fri, 31 Oct 2008 18:16:26 +0530 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1225457271 16841 80.91.229.12 (31 Oct 2008 12:47:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2008 12:47:51 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: "Juanma Barranquero" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 31 13:48:53 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KvtQb-0004sQ-9d for ged-emacs-devel@m.gmane.org; Fri, 31 Oct 2008 13:48:37 +0100 Original-Received: from localhost ([127.0.0.1]:56645 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KvtPU-0002c8-MF for ged-emacs-devel@m.gmane.org; Fri, 31 Oct 2008 08:47:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KvtOf-0001yi-RW for emacs-devel@gnu.org; Fri, 31 Oct 2008 08:46:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KvtOe-0001xi-CD for emacs-devel@gnu.org; Fri, 31 Oct 2008 08:46:37 -0400 Original-Received: from [199.232.76.173] (port=48516 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KvtOe-0001xf-2U for emacs-devel@gnu.org; Fri, 31 Oct 2008 08:46:36 -0400 Original-Received: from ti-out-0910.google.com ([209.85.142.184]:27934) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KvtOa-0000zo-68; Fri, 31 Oct 2008 08:46:33 -0400 Original-Received: by ti-out-0910.google.com with SMTP id u5so645697tia.10 for ; Fri, 31 Oct 2008 05:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=wr4epcdPheVqmEWifkCqwIlv4tIn4TQf8D40qiVuyok=; b=G2xBQn9ztwDRQ8zjwaF1TdAmLE8EI1jz4fZ8cJjJHtrjbPk+4REFLvCURtdGKt+HQu 5AXRpbcuTnntEaTcnhyn+8ZFO1r26+ZvSZE8pKxmU33XsZSOKak0CrdIbsQz4HyJSibr oBzzCi6+q1fdYM0eOOh7KSmOeuhPmETZ6is+Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=nTbOxH4S0BEVs5ZPDCLnQkekndAXW9kdNnymBfA9U6ML/7LI8he0ZoohJYzqc8OsFP hWdgwPlM3aswvxyAnQWe8qDLtg6ul4Lq7V/7/qsnCXdc/99zCNqlpp8vXDU4Pe+x79aS eOm3/EnqqXMIa72/9NN/tfyElO6XsoGbtDSgQ= Original-Received: by 10.110.52.1 with SMTP id z1mr8355028tiz.55.1225457186213; Fri, 31 Oct 2008 05:46:26 -0700 (PDT) Original-Received: by 10.110.93.2 with HTTP; Fri, 31 Oct 2008 05:46:26 -0700 (PDT) In-Reply-To: Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:105194 Archived-At: The following patch fixes this issue since tty and TERM does not make sense on windows (a wild guess though) ... diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 0bbc385..0452cb3 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1446,7 +1446,6 @@ main (argc, argv) char *tty_name = NULL; #ifndef WINDOWSNT tty_name = ttyname (fileno (stdout)); -#endif if (! tty_name) { @@ -1468,15 +1467,19 @@ main (argc, argv) " is not supported\n", progname); fail (); } +#endif + #if !defined (NO_SOCKETS_IN_FILE_SYSTEM) init_signals (); #endif +#ifndef WINDOWSNT send_to_emacs (emacs_socket, "-tty "); quote_argument (emacs_socket, tty_name); send_to_emacs (emacs_socket, " "); quote_argument (emacs_socket, type); send_to_emacs (emacs_socket, " "); +#endif } if (window_system) On Fri, Oct 31, 2008 at 5:57 PM, Juanma Barranquero wrote: > On Fri, Oct 31, 2008 at 12:15, Eli Zaretskii wrote: > >> Can you please explain why is this a problem on Windows? I understand >> that the addition of current_frame to the `if' clause causes it to be >> entered on Windows, whereas it wasn't before, but how does that, and >> the fact that tty_name is NULL, cause emacsclient failure reported by >> dhruva? > > I don't know why dhruva got the "connect" error message. My guess is > that they are two different problems: > > 1.- emacsclient opened the socket (so no INVALID_SOCKET), but couldn't connect > 2.- emacsclient couldn't get the terminal name, and it didn't have > alternate-editor > > though I don't know how or why 2) would happen, unless there were two > different emacsclients involved, called through alternate-editor (and > even so, it doesn't make much sense). > > But anyway, my point was just that the very next code after the if() is > > char *type = egetenv ("TERM"); > char *tty_name = NULL; > #ifndef WINDOWSNT > tty_name = ttyname (fileno (stdout)); > #endif > > if (! tty_name) > { > message (TRUE, "%s: could not get terminal name\n", progname); > fail (); > } > > so entering the if() is *always* going to fail(). I'm unable to see > how that be useful on Windows. > >> Agreed (to the ``ugly'' part). > > Glad we agree on this :) > > Have you any comment about the other part? ("Are there legitimate uses > of tty == 1 on Windows?") > >> I'd like to try to find a less ugly fix. > > It's Chong's patch, perhaps he can shed a bit of light. > > Juanma > -- Contents reflect my personal views only!