GNU bug report logs - #50849
28.0.50; Proposal for Emacs daemon to signal when being busy

Previous Next

Package: emacs;

Reported by: Jean Louis <bugs <at> gnu.support>

Date: Mon, 27 Sep 2021 14:28:02 UTC

Severity: wishlist

Tags: patch

Found in version 28.0.50

Fixed in version 29.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #141 received at 50849 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, 50849 <at> debbugs.gnu.org, stefankangas <at> gmail.com,
 bugs <at> gnu.support, visuweshm <at> gmail.com
Subject: Re: bug#50849: 28.0.50; Proposal for Emacs daemon to signal when
 being busy
Date: Fri, 09 Sep 2022 10:47:23 +0200
>>>>> On Thu, 08 Sep 2022 19:02:50 +0300, Eli Zaretskii <eliz <at> gnu.org> said:

    >> So if we set DEFAULT_TIMEOUT to 0, people who do nothing get no
    >> messages, and people who do --timeout get messages. I think that
    >> satisfies Eliʼs concern about compatibility

    Eli> Yes, I think so.

    >> (Iʼd even go so far as not setting the timeout at all if itʼs not
    >> requested. Why yes, I am paranoid about changing old code).

    Eli> I agree.

So this simplifies the code considerably, and in fact removes the
whole retry thing completely.

diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 49d90a989f..b9ade602e4 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -66,8 +66,6 @@ Copyright (C) 1986-2022 Free Software Foundation, Inc.
 
 #endif /* !WINDOWSNT */
 
-#define DEFAULT_TIMEOUT (30)
-
 #include <ctype.h>
 #include <errno.h>
 #include <getopt.h>
@@ -2137,35 +2135,24 @@ main (int argc, char **argv)
     }
   fflush (stdout);
 
-  set_socket_timeout (emacs_socket, timeout > 0 ? timeout : DEFAULT_TIMEOUT);
+  if (timeout > 0)
+      set_socket_timeout (emacs_socket, timeout);
   bool saw_response = false;
+
   /* Now, wait for an answer and print any messages.  */
   while (exit_status == EXIT_SUCCESS)
     {
-      bool retry = true;
-      bool msg_showed = quiet;
       do
 	{
 	  act_on_signals (emacs_socket);
 	  rl = recv (emacs_socket, string, BUFSIZ, 0);
-	  retry = check_socket_timeout (rl);
-	  if (retry && !saw_response)
-	    {
-	      if (timeout > 0)
-		{
-		  /* Don't retry if we were given a --timeout flag.  */
-		  fprintf (stderr, "\nServer not responding; timed out after %lu seconds",
-			   timeout);
-		  retry = false;
-		}
-	      else if (!msg_showed)
-		{
-		  msg_showed = true;
-		  fprintf (stderr, "\nServer not responding; use Ctrl+C to break");
-		}
-	    }
+	  if (timeout > 0
+	      && check_socket_timeout (rl)
+	      && !saw_response)
+	    fprintf (stderr, "\nServer not responding; timed out after %lu seconds",
+		     timeout);
 	}
-      while ((rl < 0 && errno == EINTR) || retry);
+      while (rl < 0 && errno == EINTR);
 
       if (rl <= 0)
         break;

Robert
-- 




This bug report was last modified 2 years and 256 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.