[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy
From: |
Robert Pluim |
Subject: |
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@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
--
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, (continued)
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Stefan Kangas, 2022/09/07
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/08
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Lars Ingebrigtsen, 2022/09/08
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/08
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Lars Ingebrigtsen, 2022/09/08
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/08
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Lars Ingebrigtsen, 2022/09/08
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/08
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Robert Pluim, 2022/09/08
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/08
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy,
Robert Pluim <=
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Stefan Kangas, 2022/09/09
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Robert Pluim, 2022/09/09
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Stefan Kangas, 2022/09/09
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/09
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Robert Pluim, 2022/09/06
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Lars Ingebrigtsen, 2022/09/06
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Po Lu, 2022/09/02
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Lars Ingebrigtsen, 2022/09/03