unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Make emacsclientw -a usable
@ 2015-07-18 22:25 Evgeny Fraimovitch
  2015-07-19 18:32 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Evgeny Fraimovitch @ 2015-07-18 22:25 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 632 bytes --]

Hello,

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.

Sincerely yours,
     Evgeny

[-- Attachment #1.2: Type: text/html, Size: 753 bytes --]

[-- Attachment #2: emacsclient.patch --]
[-- Type: application/octet-stream, Size: 750 bytes --]

diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 357ebc7..74722ef 100644
--- 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;
     }
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make emacsclientw -a usable
  2015-07-18 22:25 [PATCH] Make emacsclientw -a usable Evgeny Fraimovitch
@ 2015-07-19 18:32 ` Eli Zaretskii
  2015-07-19 19:15   ` Evgeny Fraimovitch
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2015-07-19 18:32 UTC (permalink / raw)
  To: Evgeny Fraimovitch; +Cc: emacs-devel

> From: Evgeny Fraimovitch <johnlen7@gmail.com>
> 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?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make emacsclientw -a usable
  2015-07-19 18:32 ` Eli Zaretskii
@ 2015-07-19 19:15   ` Evgeny Fraimovitch
  2015-07-27 22:33     ` Evgeny Fraimovitch
  0 siblings, 1 reply; 6+ messages in thread
From: Evgeny Fraimovitch @ 2015-07-19 19:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Sun, Jul 19, 2015 at 9:32 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Evgeny Fraimovitch <johnlen7@gmail.com>
>> 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;
     }



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make emacsclientw -a usable
  2015-07-19 19:15   ` Evgeny Fraimovitch
@ 2015-07-27 22:33     ` Evgeny Fraimovitch
  2015-07-28  2:32       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Evgeny Fraimovitch @ 2015-07-27 22:33 UTC (permalink / raw)
  To: emacs-devel

Evgeny Fraimovitch <johnlen7@gmail.com> writes:

> On Sun, Jul 19, 2015 at 9:32 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>>> From: Evgeny Fraimovitch <johnlen7@gmail.com>
>>> 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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make emacsclientw -a usable
  2015-07-27 22:33     ` Evgeny Fraimovitch
@ 2015-07-28  2:32       ` Eli Zaretskii
  2015-08-02 14:50         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2015-07-28  2:32 UTC (permalink / raw)
  To: Evgeny Fraimovitch; +Cc: emacs-devel

> From: Evgeny Fraimovitch <johnlen7@gmail.com>
> Date: Tue, 28 Jul 2015 01:33:53 +0300
> 
> Sorry for posting this patch again, is there anything I need to augment
> in this patch before it's accepted?

No, it's just a matter of time until it finds its way into the
repository.

Thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make emacsclientw -a usable
  2015-07-28  2:32       ` Eli Zaretskii
@ 2015-08-02 14:50         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2015-08-02 14:50 UTC (permalink / raw)
  To: johnlen7; +Cc: emacs-devel

> Date: Tue, 28 Jul 2015 05:32:10 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> > From: Evgeny Fraimovitch <johnlen7@gmail.com>
> > Date: Tue, 28 Jul 2015 01:33:53 +0300
> > 
> > Sorry for posting this patch again, is there anything I need to augment
> > in this patch before it's accepted?
> 
> No, it's just a matter of time until it finds its way into the
> repository.

Done.  Sorry for the long delay, and thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-02 14:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-18 22:25 [PATCH] Make emacsclientw -a usable Evgeny Fraimovitch
2015-07-19 18:32 ` Eli Zaretskii
2015-07-19 19:15   ` Evgeny Fraimovitch
2015-07-27 22:33     ` Evgeny Fraimovitch
2015-07-28  2:32       ` Eli Zaretskii
2015-08-02 14:50         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).