emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Make emacsclientw -a usable


From: Evgeny Fraimovitch
Subject: Re: [PATCH] Make emacsclientw -a usable
Date: Tue, 28 Jul 2015 01:33:53 +0300
User-agent: Notmuch/0.19 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-redhat-linux-gnu)

Evgeny Fraimovitch <address@hidden> writes:

> On Sun, Jul 19, 2015 at 9:32 PM, Eli Zaretskii <address@hidden> wrote:
>>> From: Evgeny Fraimovitch <address@hidden>
>>> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]