From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Evgeny Fraimovitch Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Make emacsclientw -a usable Date: Tue, 28 Jul 2015 01:33:53 +0300 Message-ID: <87io952pta.fsf@deathstar.qsp.homelinux.org> References: <83twt03snw.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1438036474 31895 80.91.229.3 (27 Jul 2015 22:34:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jul 2015 22:34:34 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 28 00:34:19 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZJqyO-0004hd-Lv for ged-emacs-devel@m.gmane.org; Tue, 28 Jul 2015 00:34:16 +0200 Original-Received: from localhost ([::1]:56136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJqyO-0004nR-5y for ged-emacs-devel@m.gmane.org; Mon, 27 Jul 2015 18:34:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJqy8-0004nJ-GG for emacs-devel@gnu.org; Mon, 27 Jul 2015 18:34:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJqy5-0003E2-A7 for emacs-devel@gnu.org; Mon, 27 Jul 2015 18:34:00 -0400 Original-Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:36186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJqy5-0003DY-2b for emacs-devel@gnu.org; Mon, 27 Jul 2015 18:33:57 -0400 Original-Received: by wicgb10 with SMTP id gb10so131673258wic.1 for ; Mon, 27 Jul 2015 15:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; bh=fE/QnCG7aZHE+K8B2eXPi99vyjednKpJeXKlyKbfQJg=; b=C8+VO63BbkRghSWmo4UAyVIi82VilPShVJbxJqjOM/b9VyBnLtYWghfhdrKfvs38cW UD/QjLnztObGhBrdnyFjEilfY/44yl6n+TtioxLAVCAsVxsMCrCJZZqsmEA9OTZ44Vmp aRuHEImJe5i7/4WH8FCFOfvTrAEV2b29SKKiVbJtOwXuJhB88atiCVFci9kEJdJ7yuJZ oNKXxVtQsPGOzHTgA/woJQICls+VRBNyBtbws0lnriPJkmlM4ObkS8el8KpWQETm7680 aQwhixX28lKebOHPy+HEKpCvH/ENEcyETnSEsZKRA1/S/TLciNQVxRudrpUP8U0flNoG CjBg== X-Received: by 10.180.74.162 with SMTP id u2mr28735372wiv.0.1438036435781; Mon, 27 Jul 2015 15:33:55 -0700 (PDT) Original-Received: from deathstar.qsp.homelinux.org ([5.22.129.172]) by smtp.gmail.com with ESMTPSA id ck18sm23962455wjb.47.2015.07.27.15.33.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jul 2015 15:33:55 -0700 (PDT) In-Reply-To: User-Agent: Notmuch/0.19 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-redhat-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::234 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:188114 Archived-At: Evgeny Fraimovitch writes: > On Sun, Jul 19, 2015 at 9:32 PM, Eli Zaretskii wrote: >>> From: Evgeny Fraimovitch >>> Date: Sat, 18 Jul 2015 22:25:31 +0000 >>> >>> Currently the emacsclientw (the non-console version of Win32 emacs client) pops >>> up a modal message box if emacs server is not running even if there is an >>> alternate specified. This makes the -a option (with or without an argument) >>> somewhat useless, since the user is greeted by a modal message box, >>> interrupting the workflow. >>> The attached patch supresses the modal message box (only in Win32 and only in >>> the non-console client) if there is an alternate editor specified - the user >>> will only get an error message if the alternative fails too. >>> >>> The patch is produced against today's emacs master. >> >> Thanks. >> >> [....] >> >> What about the other call to sock_err_message in that function, >> doesn't it need to be handled the same way in emacsclientw? > > We can handle both for symmetry, though the chances of the first call > failing on the initial try and succeeding later are slim: > Sorry for posting this patch again, is there anything I need to augment in this patch before it's accepted? I have addressed the lack of symmetry in return value checking noted above. diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 357ebc7..077bd65 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -961,14 +961,24 @@ set_tcp_socket (const char *local_server_file) /* Open up an AF_INET socket. */ if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { - sock_err_message ("socket"); + /*Since we have an alternate to try out this is not an error yet + popping out a modal dialog at this stage would make -a option totally + useless for emacsclientw - the user will still get an error message + if the alternate editor fails*/ +#ifdef WINDOWSNT + if(!(w32_window_app() && alternate_editor)) +#endif + sock_err_message ("socket"); return INVALID_SOCKET; } /* Set up the socket. */ if (connect (s, (struct sockaddr *) &server, sizeof server) < 0) { - sock_err_message ("connect"); +#ifdef WINDOWSNT + if(!(w32_window_app() && alternate_editor)) +#endif + sock_err_message ("connect"); return INVALID_SOCKET; } Thanks, Evgeny