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: Sun, 19 Jul 2015 22:15:25 +0300 Message-ID: References: <83twt03snw.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1437333353 17441 80.91.229.3 (19 Jul 2015 19:15:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 Jul 2015 19:15:53 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 19 21:15:53 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 1ZGu3z-00072A-Gj for ged-emacs-devel@m.gmane.org; Sun, 19 Jul 2015 21:15:51 +0200 Original-Received: from localhost ([::1]:52500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGu3y-0005lD-8u for ged-emacs-devel@m.gmane.org; Sun, 19 Jul 2015 15:15:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGu3g-0005l7-UX for emacs-devel@gnu.org; Sun, 19 Jul 2015 15:15:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZGu3f-0007fN-Jx for emacs-devel@gnu.org; Sun, 19 Jul 2015 15:15:32 -0400 Original-Received: from mail-lb0-x231.google.com ([2a00:1450:4010:c04::231]:35234) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGu3a-0007co-QX; Sun, 19 Jul 2015 15:15:27 -0400 Original-Received: by lblf12 with SMTP id f12so84574991lbl.2; Sun, 19 Jul 2015 12:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=G8XTmHwEdaykKdYao+E/96RjjCxniRBw5riAt3wk6lU=; b=Wq2IpNW38p0hT9w9qGWbK7YuxGCWN3fiOaTpyl1LOicVj36jCmbT56cyfyByMEWEHv Nu6ydI77cDSEftgkOAaoRfTyHoiTE1+6vd5rxYHd38K3552fJGphKbgQHdUNzEkKgT8G PtN864PPZ1luXkDZ9T6QplGdfKcJf2Gokc3iOYEOywCtP5ZxKdjIzMR8XsQIMciNmHA8 zQOLAe9kApwmVEUXTjUrxFkR8tiuxMKODSLsmy9vyYiLwnOiI7kva7aJ/uP/SYH+xUZo YmIq5bSBio34ic0t05cQqw5fLhpAapHYTFOz4q7IM9LpU1XhlCRP12+iK/ykKtDwAkNH n79A== X-Received: by 10.152.21.37 with SMTP id s5mr23670145lae.2.1437333325794; Sun, 19 Jul 2015 12:15:25 -0700 (PDT) Original-Received: by 10.112.72.231 with HTTP; Sun, 19 Jul 2015 12:15:25 -0700 (PDT) In-Reply-To: <83twt03snw.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::231 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:187999 Archived-At: 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. > >> --- a/lib-src/emacsclient.c >> +++ b/lib-src/emacsclient.c >> @@ -968,7 +968,14 @@ set_tcp_socket (const char *local_server_file) >> /* Set up the socket. */ >> if (connect (s, (struct sockaddr *) &server, sizeof server) < 0) >> { >> - sock_err_message ("connect"); >> + /*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 ("connect"); >> return INVALID_SOCKET; >> } > > 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: 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; }